using ZB.MOM.WW.OtOpcUa.Core.Abstractions;

namespace ZB.MOM.WW.OtOpcUa.Driver.FOCAS;

public static class FocasDataTypeExtensions
{
    /// <summary>Converts a FOCAS data type to the corresponding driver data type.</summary>
    /// <param name="t">The FOCAS data type to convert.</param>
    /// <returns>The equivalent driver data type.</returns>
    public static DriverDataType ToDriverDataType(this FocasDataType t) => t switch
    {
        FocasDataType.Bit => DriverDataType.Boolean,
        FocasDataType.Byte or FocasDataType.Int16 or FocasDataType.Int32 => DriverDataType.Int32,
        FocasDataType.Float32 => DriverDataType.Float32,
        FocasDataType.Float64 => DriverDataType.Float64,
        FocasDataType.String => DriverDataType.String,
        _ => DriverDataType.Int32,
    };
}
