/*!
 *
 * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved.
 * \copyright                                                       \n
 *          THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM,  \n
 *          IN PART OR IN WHOLE,                                    \n
 *          WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. \n
 *
 * \file    TreatmentTime.qml
 * \date    2020/01/31
 * \author  Behrouz NematiPour
 *
 */

// Qt
import QtQuick 2.12

// Project

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

/*!
 * \brief   Treatment Screen Treatment Time Remaining section
 */
Rectangle { id: _root
    objectName: "TreatmentTime"
    property int minimum        : 0
    property int maximum        : vTreatmentTime.time_Total
    property int progressValue  : vTreatmentTime.time_Elapsed
    property int timeTextValue  : vTreatmentTime.time_Remaining

    signal clicked()

    anchors.centerIn: parent
    width : _circle.width
    height: _circle.height
    color: "transparent"

    ProgressCircle { id: _circle
        minimum: _root.minimum
        maximum: _root.maximum

        anchors.centerIn  : parent
        value: _root.progressValue
    }

    TimeText { id: _timeText
        anchors.centerIn  : parent
        seconds : _root.timeTextValue
    }

    Rectangle { id: _timeTitleRect
        color: "Transparent"
        anchors.horizontalCenter: _timeText.horizontalCenter
        anchors.bottom: _timeText.top

        width   : _timeTitle.width + _arrowImage.width + _arrowImage.anchors.leftMargin
        height  : _timeTitle.height

        Text { id: _timeTitle
            text: qsTr("Time Remaining")

            font.pixelSize: 26
            color: "white"

            anchors.left: parent.left
            Image { id: _arrowImage
                visible: true
                anchors.left  : parent.right
                anchors.bottom: parent.baseline
                anchors.leftMargin: 10
                width : Variables.arrowWidth
                height: Variables.arrowHeight
                source: "qrc:/images/iArrow"
            }
        }
    }

    MouseArea { id: _mouseArea
        anchors.fill: parent
        onClicked: {
            _root.clicked()
        }
    }
}

