/*!
 *
 * Copyright (c) 2020-2025 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    TreatmentAdjustmentUltrafiltrationMetrics.qml
 * \author  (last)      Stephen Quong
 * \date    (last)      19-Aug-2025
 * \author  (original)  Stephen Quong
 * \date    (original)  19-Aug-2025
 *
 */

// Qt
import QtQuick 2.12

// Project

//  Qml imports
import "qrc:/globals"

/*!
 * \brief   TreatmentAdjustmentUltrafiltrationMetrics contains components
 *          that display the ultrafiltration volume removed and goal.
 */
Item { id: _root
    property real setVolume     : 0
    property real volumeRemoved : 0

    component ValueItem: Rectangle { id: _valueItem
        property alias label        : _label.text
        property alias value        : _value.text
        property color textColor    : Colors.fluidText
        anchors.centerIn    : parent
        width               : 350
        height              : 60
        radius              : 5
        color               : Colors.panelBackgroundColor
        border {
            width   : Variables.panelBorderWidth
            color   : Colors.panelBorderColor
        }

        Item { id: _textContainer
            anchors.centerIn: parent
            width           : childrenRect.width
            height          : parent.height

            Text { id: _label
                anchors{
                    left            : parent.left
                    verticalCenter  : parent.verticalCenter
                }
                width   : contentWidth
                color   : textColor
                font {
                    pixelSize       : Fonts.fontPixelButton
                    weight          : Font.Medium
                }
            }

            Text { id: _value
                anchors{
                    left            : _label.right
                    verticalCenter  : parent.verticalCenter
                }
                width   : contentWidth
                color   : textColor
                font {
                    pixelSize       : Fonts.fontPixelUltrafiltrationAdjustmentMetrics
                    weight          : Font.DemiBold
                }
            }
        }
    }

    ValueItem { id: _ufVolumeRemovedItem
        anchors.horizontalCenterOffset  : -(width/2 + 30)
        label                           : qsTr("UF Volume Removed: ")
        value                           : _root.volumeRemoved.toFixed(Variables.ultrafiltrationPrecision)
    }

    ValueItem { id: _ufVolumeGoalItem
        anchors.horizontalCenterOffset  : -(_ufVolumeRemovedItem.anchors.horizontalCenterOffset)
        textColor                       : Colors.ufVolumeGoalText
        label                           : qsTr("UF Volume Goal: ")
        value                           : _root.setVolume.toFixed(Variables.ultrafiltrationPrecision)
    }
}
