/*!
 *
 * Copyright (c) 2020-2022 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    TreatmentAdjustmentBase.qml
 * \author  (last)      Behrouz NematiPour
 * \date    (last)      04-Oct-2022
 * \author  (original)  Behrouz NematiPour
 * \date    (original)  22-Mar-2020
 *
 */

// Qt
import QtQuick 2.12

// Project

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

/*!
 * \brief   TreatmentAdjustmentBase.qml is the base screen
 *          For all adjustment screens in treatment
 */
ModalDialog { id: _root
    contentItem.objectName: "TreatmentAdjustmentBase"  //SquishQt testability

    property string titleText: ""

    property bool   closeVisible: true
    property bool confirmVisible: true
    property bool    backVisible: false
    property alias   information: _information

    signal   closeClicked()
    signal confirmClicked()
    signal    backClicked()

    onVisibleChanged: {
        notificationText = ""
    }

    header:
    Rectangle { id : _headerRect
        ConfirmButton { id : _confirmButton
            visible: _root.confirmVisible
            onClicked : confirmClicked()
        }
        BackButton { id : _backButton
            visible: _root.backVisible
            onClicked : backClicked()
        }

        TitleText { id : _titleText
            text: titleText
            font.pixelSize: Fonts.fontPixelButton
            color: Colors.textMain
            height: Variables.mainMenuHeight
            anchors {
                top: parent.top
                horizontalCenter: parent.horizontalCenter
                margins: 35
            }
        }

        CloseButton { id : _closeButton
            visible: _root.closeVisible
            anchors.left: parent.left
            onClicked : {
                closeClicked()
                close()
            }
        }
    }

    // this notification shall not be confused with the _notification in the parent ModalDailog
    // this meant to be used specifically as current state notification like paused/off in UF
    // it is also available in TreatmentAdjustmentFlow and TreatmentAdjustmentDuration but not used.
    NotificationBarSmall { id: _information
        visible     : false
        imageSource : ""
        text        : ""
    }
}
