import QtQuick 2.12
import QtQuick.Layouts 1.12
import "../"

Rectangle {
    id: root
    color: "#e6f0ea"
    property var userData
    property var indexOfDelegate
    anchors.horizontalCenter: parent.horizontalCenter
    width: parent.width - 30
    onIndexOfDelegateChanged: {
        if (indexOfDelegate % 2 == 0) {
            root.color = "#debaba"
        } else {
            root.color = "#ded1ba"
        }
    }

    onUserDataChanged: {
        id_source.text = userData.source
        id_destination.text = userData.destination
        id_message.text = userData.message
        id_duration.text = userData.duration
    }

    RowLayout {
        anchors.fill: parent
        clip: true

        C_DataField {
            id: id_source
            Layout.minimumWidth: 200
            Layout.preferredWidth: 200
        }
        C_DataField {
            id: id_destination
            Layout.minimumWidth: 200
            Layout.preferredWidth: 200
        }
        C_DataField {
            id: id_message
            Layout.minimumWidth: 200
            Layout.preferredWidth: 200
            Layout.fillWidth: true
        }
        C_DataField {
            id: id_duration
            Layout.minimumWidth: 100
            Layout.preferredWidth: 100
        }
    }
}