/*!
 *
 * 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    TreatmentPressures.qml
 * \author  (last)      Behrouz NematiPour
 * \date    (last)      31-May-2023
 * \author  (original)  Behrouz NematiPour
 * \date    (original)  01-Nov-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     : vTreatmentRanges.arterialPressureMonitorMin
    property int    arterialMaximum     : vTreatmentRanges.arterialPressureMonitorMax
    property int    venousMinimum       : vTreatmentRanges.venousPressureMonitorMin
    property int    venousMaximum       : vTreatmentRanges.venousPressureMonitorMax

    property int    arterialLowerBound  : vTreatmentPressureOcclusion.arterialPressureLimitLowerBound
    property int    arterialUpperBound  : vTreatmentPressureOcclusion.arterialPressureLimitUpperBound
    property int    venousLowerBound    : vTreatmentPressureOcclusion.venousPressureLimitLowerBound
    property int    venousUpperBound    : vTreatmentPressureOcclusion.venousPressureLimitUpperBound
    property int    arterialPressure    : vTreatmentPressureOcclusion.arterialPressure
    property int    venousPressure      : vTreatmentPressureOcclusion.venousPressure

    property bool   valueOutRangeNotify : true

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

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

        minimum     : _root.arterialMinimum
        lowerBound  : _root.arterialLowerBound
        upperBound  : _root.arterialUpperBound
        maximum     : _root.arterialMaximum
        value       : _root.arterialPressure
        color       : valueOutRangeNotify ? Colors.backgroundRangeRect : rangebar.color

        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: 210
        y: 80
        width   : 175
        height  :  15
        rangebar.color: Colors.pressuresVenousBar
        markerOutRangeNotify: _root.valueOutRangeNotify

        minimum     : _root.venousMinimum
        lowerBound  : _root.venousLowerBound
        upperBound  : _root.venousUpperBound
        maximum     : _root.venousMaximum
        value       : _root.venousPressure
        color       : valueOutRangeNotify ? Colors.backgroundRangeRect : rangebar.color

        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()
    }
}
