using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;
namespace Lab505.Sim;
#region API Models
///
/// Base API result
///
public class ApiResult
{
public bool IsSuccess { get; set; }
public string Message { get; set; } = string.Empty;
}
///
/// Robot state result
///
public class RobotStateResult : ApiResult
{
public RobotStateData? Data { get; set; }
}
///
/// Robot state data
///
public class RobotStateData
{
public string RobotId { get; set; } = string.Empty;
public Guid MapId { get; set; }
public bool IsOnline { get; set; }
public string State { get; set; } = string.Empty;
public VdaStateMsg StateMsg { get; set; } = new();
public VdaVisualizationMsg VisualizationMsg { get; set; } = new();
}
///
/// VDA5050 State message
///
public class VdaStateMsg
{
public uint HeaderId { get; set; }
public string? Timestamp { get; set; }
public string? Version { get; set; }
public string? Manufacturer { get; set; }
public string? SerialNumber { get; set; }
public string? OrderId { get; set; }
public int OrderUpdateId { get; set; }
public string? LastNodeId { get; set; }
public int LastNodeSequenceId { get; set; }
public bool Driving { get; set; }
public bool Paused { get; set; }
public bool NewBaseRequest { get; set; }
public double DistanceSinceLastNode { get; set; }
public string? OperatingMode { get; set; }
public VdaAgvPosition AgvPosition { get; set; } = new();
public VdaActionState[] ActionStates { get; set; } = [];
public VdaError[] Errors { get; set; } = [];
}
///
/// VDA5050 Visualization message
///
public class VdaVisualizationMsg
{
public uint HeaderId { get; set; }
public string? Timestamp { get; set; }
public string? Version { get; set; }
public string? Manufacturer { get; set; }
public string? SerialNumber { get; set; }
public VdaAgvPosition AgvPosition { get; set; } = new();
}
///
/// AGV Position
///
public class VdaAgvPosition
{
public double X { get; set; }
public double Y { get; set; }
public double Theta { get; set; }
public string? MapId { get; set; }
public bool PositionInitialized { get; set; }
}
///
/// Action state
///
public class VdaActionState
{
// VDA5050 field name là "actionId" (camelCase) — robot báo về với key này.
[JsonPropertyName("actionId")]
public string ActionID { get; set; } = string.Empty;
public string ActionType { get; set; } = string.Empty;
public string? ActionDescription { get; set; }
public string ActionStatus { get; set; } = string.Empty; // WAITING, INITIALIZING, RUNNING, FINISHED, FAILED, PAUSED
}
///
/// VDA Error
///
public class VdaError
{
public string ErrorType { get; set; } = string.Empty;
public string? ErrorDescription { get; set; }
public string ErrorLevel { get; set; } = string.Empty; // WARNING, FATAL
}
///
/// Instant action request
///
public class VdaInstantAction
{
public string ActionId { get; set; } = string.Empty;
public string ActionType { get; set; } = string.Empty;
public string ActionDescription { get; set; } = string.Empty;
public string BlockingType { get; set; } = "NONE";
public List ActionParameters { get; set; } = [];
}
///
/// Action parameter
///
public class VdaActionParameter
{
public string Key { get; set; } = string.Empty;
public string Value { get; set; } = string.Empty;
}
#endregion