/*!
 *
 * 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    PostTreatmentEnd.qml
 * \author  (last)      Behrouz NematiPour
 * \date    (last)      10-Feb-2021
 * \author  (original)  Behrouz NematiPour
 * \date    (original)  03-Feb-2021
 *
 */

// Qt
import QtQuick 2.12

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

/*!
 * \brief   the post treatment end screen
 */
ScreenItem { id: _root
    objectName: "_PostTreatmentEnd"

    property alias  reasonText  : _notification.text

    signal rinsebackClicked()

    QtObject { id: _private
        property int sectionSpace : 30
        property int sectionWidth : _root.width  * 2/3 - sectionSpace * 1.5
        property int sectionHeight: _root.width  * 1/3 - sectionSpace * 1.5
    }
    Text { id: _title
        anchors {
            top: parent.top
            topMargin: 65
            horizontalCenter: parent.horizontalCenter
        }
        color: Colors.white
        text: qsTr("Treatment Complete")
        font.pixelSize: Fonts.fontPixelTitle
    }

    TimeText { id: _timeout // not sure if this screen has a timeout
        visible         : false
        anchors {
            horizontalCenter: parent.horizontalCenter
            top             : _title.bottom
            topMargin       : 15
        }
        textPixelSize   : 30
        textWeight      : Font.Normal
        secondsVisible  : false
        seconds         : 0
    }

    Rectangle {
        color   : Colors.backgroundDialog
        width   : _private.sectionWidth
        height  : _private.sectionHeight
        border.width: 2
        border.color: Colors.borderDisableButton
        radius: 10
        anchors.centerIn: parent
        Text { id: _visualAID
            anchors.centerIn: parent
            color: Colors.white
            text: qsTr("Visual AID\nplaceholder")
            font.pixelSize: Fonts.fontPixelButton
        }
    }

    Row { id: _buttonGroup
        property int buttonsWidth   : 300
        spacing: 75

        anchors {
            bottom          : parent.bottom
            horizontalCenter: parent.horizontalCenter
            rightMargin     : spacing
            leftMargin      : spacing
            bottomMargin    : spacing
        }

        TouchRect { id : _startRinsebackTouchRect
            visible         : true
            text.text       : qsTr("START RINSEBACK")
            width           : _buttonGroup.buttonsWidth
            color           : borderColor
            onClicked       : rinsebackClicked()
        }
    }

    NotificationBar { id: _notification
        iconVisible: false
    }

    onVisibleChanged: {
        _notification.text = ""
        if (visible) {
            _mainMenu     .hidden = true
            _treatmentMenu.hidden = true
        }
    }
}
