/*!
 *
 * 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    TimeCircle.qml
 * \author  (last)      Behrouz NematiPour
 * \date    (last)      09-Apr-2021
 * \author  (original)  Behrouz NematiPour
 * \date    (original)  18-Mar-2021
 *
 */

// Qt
import QtQuick 2.12

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

/*!
 * \brief   Time Circle Component
 * \details which contains a TimeText and ProgressCircle
 *          Progress is connected to the time and will show time remained progress.
 *          Time shows the time in minutes and seconds.
 */
Item { id: _root
    objectName: "_TimeCircle"

    property alias  diameter: _progressCircle.diameter
    property alias thickness: _progressCircle.thickness

    property bool   isChecked           : false // isComplete
    property int    minimum             : 0
    property int    maximum             : 0 // total
    property int    progressValue       : 0 // elapsed
    property int    timeTextValue       : 0 // remaining
    property alias  timeTextPixelSize   : _timeText.textPixelSize
    property alias  secondsVisible      : _timeText.secondsVisible

    width   : diameter
    height  : diameter

    ProgressCircle { id: _progressCircle
        minimum     : _root.minimum
        maximum     : _root.maximum
        anchors.centerIn: parent
        value       : _root.progressValue

        TimeText { id: _timeText
            Behavior on opacity { OpacityAnimator { duration: 1000 } }
            opacity         : _root.isChecked ? 0 : 1
            anchors.centerIn: parent
            seconds         : _root.timeTextValue
            secondsVisible  : false
        }

        Image { id: _image
            Behavior on opacity { OpacityAnimator { duration: 1000 } }
            opacity         : _root.isChecked ? 1 : 0
            anchors.centerIn: parent
            source          : "qrc:/images/iCheck"
        }
    }
}
