/*!
 *
 * Copyright (c) 2019-2020 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 TreatmentPressuresLimits.qml
 * \author (last) Behrouz NematiPour
 * \date (last) 16-Oct-2020
 * \author (original) Behrouz NematiPour
 * \date (original) 27-Jan-2020
 *
 */

// Qt
import QtQuick 2.12

// Project

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

/*!
 * \brief   Treatment Screen Pressure section
 */
TouchArea { id: _root
    property int    arterialMinimum     : 0
    property int    arterialLowerBound  : 0
    property int    arterialUpperBound  : 0
    property int    arterialMaximum     : 0

    property int    venousMinimum       : 0
    property int    venousLowerBound    : 0
    property int    venousUpperBound    : 0
    property int    venousMaximum       : 0

    property int    arterilPressure     : 0
    property int    venousPressure      : 0

    clip: false
    x       : 0
    y       : 0
    width   : 200
    height  : 200
    isTouchable: true
    title: qsTr("PRESSURE") + " " + qsTr("(mmHg)")

    /*
      Since this Component cannot be bound to the properties since it has to make sure the request has been accepted.
      Because the pressure response regardless of the accepted/rejected the FW Software message will pass what is preferred.
     */
    function setBounds(vArterialLimitLow  ,
                       vArterialLimitHigh ,
                       vVenousLimitLow    ,
                       vVenousLimitHigh   ) {
        _root.arterialLowerBound = vArterialLimitLow
        _root.arterialUpperBound = vArterialLimitHigh
        _root.venousLowerBound   = vVenousLimitLow
        _root.venousUpperBound   = vVenousLimitHigh
    }

    RangeBar { id: _arterialRangeBar
        x: 0
        y: 80
        width   : 175
        height  :  15
        rangebar.color: Colors.pressuresArterialBar
        markerOutRangeNotify: true

        minimum     : _root.arterialMinimum
        lowerBound  : _root.arterialLowerBound
        upperBound  : _root.arterialUpperBound
        maximum     : _root.arterialMaximum
        value       : _root.arterilPressure

        Text { id: _arterialText
            anchors {
                left: parent.left
                top: parent.bottom
                topMargin: 35
            }
            text: qsTr("Arterial")
            font.pixelSize: Fonts.fontPixelPresseuresText
            color: Colors.pressuresText
        }
        onClicked: _root.clicked()
    }

    RangeBar { id: _venousRangeBar
        x: 200
        y: 80
        width   : 175
        height  :  15
        rangebar.color: Colors.pressuresVenousBar
        markerOutRangeNotify: true

        minimum     : _root.venousMinimum
        lowerBound  : _root.venousLowerBound
        upperBound  : _root.venousUpperBound
        maximum     : _root.venousMaximum
        value       : _root.venousPressure

        Text { id: _venousText
            anchors {
                left: parent.left
                top: parent.bottom
                topMargin: 35
            }
            text: qsTr("Venous")
            font.pixelSize: Fonts.fontPixelPresseuresText
            color: Colors.pressuresText
        }
        onClicked: _root.clicked()
    }
}
