using System;
using System.Collections.Generic;
using System.ComponentModel;
using CommonUsage.Protocols.VDA5050.Objects;

namespace CommonUsage.Protocols.VDA5050.Messages
{
    /// <summary>
    /// 6.10 Topic: "state" (from AGV to master control)
    /// todo: complete all fields required by VDA5050
    /// </summary>
    public class stateMessage
    {
        public uint headerId;
        public string timestamp = "";
        public string version = "";
        public string manufacturer = "";
        public string serialNumber = "";
        /// <summary>
        /// Unique order identification of the current order or the previously finished order.
        /// The orderId is kept until a new order is received.
        /// Empty string (""), if no previous orderId is available.
        /// </summary>
        public string orderId = "";

        /// <summary>
        /// Order update identification to identify, that an order update has been accepted by the AGV.
        /// "0" if no previous orderUpdateId is available.
        /// </summary>
        public uint orderUpdatedId = 0;

        public string lastNodeId;

        public uint lastNodeSequenceId;

        /// <summary>
        /// Array of nodeState objects that need to be traversed for fulfilling the order (empty array if idle)
        /// </summary>
        public nodeState[] nodeStates = [];

        /// <summary>
        /// Array of edgeState objects that need to be traversed for fulfilling the order (empty array if idle)
        /// </summary>
        public edgeState[] edgeStates = [];

        public agvPosition agvPosition;

        public velocity velocity;
        public load[] loads = [];

        public bool driving;

        public bool paused;

        public bool newBaseRequest;

        public double distanceSinceLastNode;

        public batteryState batteryState;

        public actionState[] actionStates = Array.Empty<actionState>();
        public string operatingMode = "";
        public List<errorState> errors { get; set; } = new List<errorState>(); // Array of errorState objects

        public info[] information = [];
        public safetyState safetyState;

    }
}
