/*!
 *
 * Copyright (c) 2025-2026 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    TreatmentHDF.qml
 * \author  (last)      Nico Ramirez
 * \date    (last)      2-Feb-2026
 * \author  (original)  Nico Ramirez
 * \date    (original)  2-Feb-2026
 *
 */

// Qt
import QtQuick 2.12

// Project

//  Qml imports
import "qrc:/globals"
import "qrc:/components"
import "qrc:/compounds"
import "qrc:/pages/treatment/sections"

ScreenItem  { id: _root
    readonly property int margin        : Variables.defaultMargin * 5
    readonly property color statusColor : Colors.statusActive

    signal sectionPressuresClicked()

    Component.onCompleted: {
        _headerBar.hdfStatusColor = _root.statusColor // TODO update later
    }

    Column { id: _column
        objectName:    "column"

        spacing: Variables.defaultMargin

        anchors {
            fill        : parent
            topMargin   : 30
            leftMargin  : _root.margin
            rightMargin : _root.margin
            margins: Variables.defaultMargin
        }

        readonly property int cellHeight: Variables.treatmentCellHeight
        readonly property int cellWidth : width / 2 - ( Variables.defaultMargin / 2 )

        Row { id: _topRow
            objectName:    "topRow"

            spacing : Variables.defaultMargin
            height  : _column.cellHeight

            TreatmentPressures { id: _treatmentPressures
                objectName      : "_treatmentPressures"
                width           : _column.cellWidth
                height          : _column.cellHeight
                onEditClicked   : sectionPressuresClicked()

                color           : Colors.panelBackgroundColor
                header.color    : Colors.heparinSectionHeader
                enableDropShadow: false
            }
        }

        TreatmentHDFComponent { id: _treatmentHdfComponent
            objectName      : "_treatmentHdfComponent"
            width           : _column.width
            height          : _column.cellHeight
            statusColor     : _root.statusColor

            onSubstitutionFlowClicked: print ("Substitution Flow Clicked")
        }
    }
}
