/*!
 *
 * Copyright (c) 2021-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    MainHome.qml
 * \author  (last)      Behrouz NematiPour
 * \date    (last)      30-Aug-2022
 * \author  (original)  Behrouz NematiPour
 * \date    (original)  01-Mar-2021
 *
 */

// Qt
import QtQuick 2.12

// Project

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

/*!
 * \brief   MainHome is the screen
 * which is the default screen in the "Treatment" stack
 */
ScreenItem { id: _root
    objectName: "_MainHome"

    property alias  reasonText  : _notification.text

    signal  startTreatment()
    signal createTreatment()

    Image {
        anchors.fill: backgroundRect
        source: "qrc:/images/iHomeBackground"
    }


    // 2 - Header
    ImageLogoD { id: _headerLogo }

    // Definitions
    TitleText { id: _titleText
        anchors.top: parent.top
        anchors.topMargin: 200                                                  //// ----- @LEAHIZED: Move to Variables.qml
        width: parent.width
        text : vDateTime.greeting
        font.pixelSize: 40                                                      //// ----- @LEAHIZED: Move to Variables.qml

    }
    Column {
        spacing: Variables.columnSpacing
        anchors.centerIn: parent
        TouchRect { id : _createTreatmentRect
            anchors.horizontalCenter: parent.horizontalCenter
            text.text   : qsTr("Create Treatment")
            onClicked   : createTreatment()
            isDefault   : true
            width       : 435                                                   //// ----- @LEAHIZED: Move to Variables.qml
            height      : 92                                                    //// ----- @LEAHIZED: Move to Variables.qml
            pixelSize   : 30                                                    //// ----- @LEAHIZED: Move to Variables.qml
        }
        TouchRect { id : _startTreatmentRect
            anchors.horizontalCenter: parent.horizontalCenter
            text.text   : qsTr("Start Treatment")
            onClicked   : startTreatment()
            isDefault   : true
            width       : 435                                                   //// ----- @LEAHIZED: Move to Variables.qml
            height      : 92                                                    //// ----- @LEAHIZED: Move to Variables.qml
            pixelSize   : 30                                                    //// ----- @LEAHIZED: Move to Variables.qml
        }
    }

    NotificationBarSmall { id: _notification
        anchors.bottomMargin: Variables.mainMenuHeight
    }

    onVisibleChanged: {
        if (visible) {
            _mainMenu.hidden = false
        }
    }
}
