import QtQuick 2.12
import QtQuick.Controls 2.12

import Controls 1.0 as Controls
import Utils 1.0

Popup {
    id: root
    x: (parent.width - width) / 2
    y: parent.height - height - 20
    closePolicy: Popup.NoAutoClose

    property string text: ""
    property bool good: true

    Controls.SubtitleLabel {
        id: label
        text: root.text
        maximumLineCount: 10
        wrapMode: Text.Wrap
        color: Palette.alternativeTextColor
    }

    background: Rectangle {
        radius: 6
        color: good ? Palette.informationColor : Palette.invalidColor
    }

    enter: Transition {
        NumberAnimation {
            property: "opacity"
            from: 0.0
            to: 1.0
            duration: 300
        }
    }

    exit: Transition {
        NumberAnimation {
            property: "opacity"
            from: 1.0
            to: 0.0
            duration: 2500
        }
    }
}
