/*!
 *
 * Copyright (c) 2020-2024 Diality Inc. - All Rights Reserved.
 * \copyright
 * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN
 * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER.
 *
 * \file    TreatmentAdjustmentUltrafiltrationStart.qml
 * \author  (last)      Vy
 * \date    (last)      16-Mar-2023
 * \author  (original)  Behrouz NematiPour
 * \date    (original)  12-May-2020
 *
 */

// Qt
import QtQuick 2.12

// Project

//  Qml imports
import "qrc:/globals"
import "qrc:/components"
import "qrc:/compounds"

/*!
 * \brief   TreatmentAdjustmentUltrafiltrationStart.qml is the screen
 *          To adjust the treatment ultrafiltration
 */
Item { id: _root
    objectName: "_TreatmentAdjustmentUltrafiltrationStart"  // SquishQt testability

    signal editClicked()
    signal isolatedUfClicked()
    signal pauseClicked()
    signal resumeClicked()

    TreatmentAdjustmentUltrafiltrationMetrics { id: _ufMetrics
        objectName: "_ufMetrics"
        anchors {
            top             : parent.top
            topMargin       : Variables.defaultMargin
            horizontalCenter: parent.horizontalCenter
        }
        leftLabel   : qsTr("UF Volume Removed")
        leftUnit    : Variables.unitVolume
        leftValue   : vTreatmentUltrafiltration.volumeRemoved.toFixed(Variables.ultrafiltrationPrecision)
        rightLabel  : qsTr("UF Volume Goal")
        rightUnit   : Variables.unitVolume
        rightValue  : vTreatmentUltrafiltration.setVolume.toFixed(Variables.ultrafiltrationPrecision)
    }

    Item { id: _contentArea
        objectName: "_contentArea"
        anchors {
            top         : _ufMetrics.bottom
            bottom      : _buttonArea.top
            left        : parent.left
            right       : parent.right
        }

        ProgressBarEx { id: _progressBarEx
            objectName  : "_progressBarEx"
            anchors {
                centerIn    : parent
            }
            decimal     : Variables.ultrafiltrationPrecision
            minimum     : vTreatmentRanges.treatmentRanges_Ultrafiltration_Volume_Min
            maximum     : vTreatmentUltrafiltration.setVolume
            value       : vTreatmentUltrafiltration.volumeRemoved
            valueEx     : vTreatmentUltrafiltration.volumeRemoved
        }
    }

    Row { id: _buttonArea
        objectName: "_buttonArea"
        anchors {
            bottom          : parent.bottom
            bottomMargin    : Variables.defaultMargin
            horizontalCenter: parent.horizontalCenter
        }
        spacing             : Variables.defaultMargin

        TouchRect { id: _pauseResumeButton
            objectName  : "_pauseResumeButton"
            width       : Variables.defaultButtonWidth
            height      : Variables.defaultButtonHeight
            text {
                text        : isUFPaused ? qsTr("Resume UF") : qsTr("Pause UF")
                font.weight : Font.Medium
            }
            isDefault   : true
            onClicked   : isUFPaused ? _root.resumeClicked() : _root.pauseClicked()
        }

        TouchRect { id: _editButton
            objectName  : "_editButton"
            width       : Variables.defaultButtonWidth
            height      : Variables.defaultButtonHeight
            text {
                text        : qsTr("Edit UF")
                font.weight : Font.Medium
            }
            isDefault   : true
            onClicked   : _root.editClicked()
        }

        TouchRect { id: _isolatedUfButton
            objectName  : "_isolatedUfButton"
            width       : Variables.defaultButtonWidth
            height      : Variables.defaultButtonHeight
            text {
                text        : qsTr("Isolated UF")
                font.weight : Font.Medium
            }
            isDefault   : true
            onClicked   : _root.isolatedUfClicked()
        }
    }
}
