<?xml version="1.0" encoding="utf-8"?>
<!--
  TimeLimit Copyright <C> 2019 - 2020 Jonas Lochmann
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation version 3 of the License.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <data>
        <variable
            name="userName"
            type="String" />

        <variable
            name="canDelete"
            type="boolean" />

        <variable
            name="currentStatus"
            type="String" />

        <variable
            name="isWorking"
            type="boolean" />

        <import type="android.view.View" />
    </data>

    <androidx.cardview.widget.CardView
        app:cardUseCompatPadding="true"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <LinearLayout
            android:padding="8dp"
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TextView
                android:text="@string/manage_parent_remove_user_title"
                android:textAppearance="?android:textAppearanceLarge"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <TextView
                tools:text="@string/manage_parent_remove_user_text"
                android:text="@{@string/manage_parent_remove_user_text(userName)}"
                android:textAppearance="?android:textAppearanceMedium"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <TextView
                tools:text="@string/manage_parent_remove_user_status_ready"
                android:text="@{currentStatus}"
                android:textAppearance="?android:textAppearanceMedium"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <EditText
                android:inputType="textPassword"
                android:enabled="@{!isWorking}"
                android:visibility="@{canDelete ? View.VISIBLE : View.GONE}"
                android:id="@+id/user_password_field"
                android:hint="@string/login_password_hint"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <Button
                android:layout_marginEnd="8dp"
                style="@style/DangerButton"
                android:enabled="@{!isWorking}"
                android:visibility="@{canDelete ? View.VISIBLE : View.GONE}"
                android:id="@+id/confirm_delete_button"
                android:layout_gravity="end"
                android:text="@string/generic_delete"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

        </LinearLayout>
    </androidx.cardview.widget.CardView>

</layout>
