/*!
 *
 * 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 TreatmentAdjustmentFlow.qml
 * \author (last) Behrouz NematiPour
 * \date (last) 30-Jul-2020
 * \author (original) Behrouz NematiPour
 * \date (original) 22-Mar-2020
 *
 */

// Qt
import QtQuick 2.12

// Project

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

/*!
 * \brief   TreatmentAdjustmentPressures.qml is the screen
 *          To adjust the treatment inline blood pressure ranges of Arterial and venous
 */
TreatmentAdjustmentBase { id: _root
    contentItem.objectName: "TreatmentAdjustmentPressures"  //SquishQt testability

    property alias   arterialPressureMinimum    : _arterialPressure.minimum
    property alias   arterialPressureLowerBound : _arterialPressure.lowerBound
    property alias   arterialPressureUpperBound : _arterialPressure.upperBound
    property alias   arterialPressureMaximum    : _arterialPressure.maximum
    property alias   arterialPressureValue      : _arterialPressure.value
    property real    arterialPressureStep       : Variables.arterialLimitStep

    property alias     venousPressureMinimum    :   _venousPressure.minimum
    property alias     venousPressureLowerBound :   _venousPressure.lowerBound
    property alias     venousPressureUpperBound :   _venousPressure.upperBound
    property alias     venousPressureMaximum    :   _venousPressure.maximum
    property alias     venousPressureValue      :   _venousPressure.value
    property real      venousPressureStep       : Variables.venousLimitStep

    readonly property int    textWidth          : 200

    titleText: qsTr("PRESSURES")

    Column { id : _pressuresColumn
        spacing: 100
        anchors.centerIn: parent
        PressureRangeSlider { id: _arterialPressure
            titleText       : qsTr("Arterial")
            anchors.horizontalCenter: parent.horizontalCenter
            progressColor   : Colors.pressuresArterialBar

            minimumMargin   : Math.abs(Variables.arterialValueMin - Variables.arterialLimitLowMin )
            lowerBoundMin   : Variables.arterialLimitLowMin
            lowerBoundMax   : Variables.arterialLimitLowMax
            upperBoundMin   : Variables.arterialLimitHighMin
            upperBoundMax   : Variables.arterialLimitHighMax
            maximumMargin   : Math.abs(Variables.arterialValueMax - Variables.arterialLimitHighMax)
            limitGap        : Variables.arterialLimitGap
            step            : arterialPressureStep
        }

        Line {
            anchors.horizontalCenter: parent.horizontalCenter
            length  : _root.width - 100
            color   : Colors.separatorLine
        }

        PressureRangeSlider { id: _venousPressure
            titleText       : qsTr("Venous")
            anchors.horizontalCenter: parent.horizontalCenter
            progressColor   : Colors.pressuresVenousBar

            minimumMargin   : Math.abs(Variables.venousValueMin - Variables.venousLimitLowMin )
            lowerBoundMin   : Variables.venousLimitLowMin
            lowerBoundMax   : Variables.venousLimitLowMax
            upperBoundMin   : Variables.venousLimitHighMin
            upperBoundMax   : Variables.venousLimitHighMax
            maximumMargin   : Math.abs(Variables.venousValueMax - Variables.venousLimitHighMax)
            limitGap        : Variables.venousLimitGap
            step            : venousPressureStep
        }
    }
}
