using S7NetCpuType = global::S7.Net.CpuType;

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

internal static class S7CpuTypeMap
{
    /// <summary>Maps the driver's <see cref="S7CpuType"/> enum to the S7.Net library's equivalent CPU type.</summary>
    /// <param name="type">The driver-configured S7 CPU type.</param>
    /// <returns>The corresponding S7.Net <c>CpuType</c> value.</returns>
    public static S7NetCpuType ToS7Net(S7CpuType type) => type switch
    {
        S7CpuType.S7200 => S7NetCpuType.S7200,
        S7CpuType.Logo0BA8 => S7NetCpuType.Logo0BA8,
        S7CpuType.S7200Smart => S7NetCpuType.S7200Smart,
        S7CpuType.S7300 => S7NetCpuType.S7300,
        S7CpuType.S7400 => S7NetCpuType.S7400,
        S7CpuType.S71200 => S7NetCpuType.S71200,
        S7CpuType.S71500 => S7NetCpuType.S71500,
        _ => throw new ArgumentOutOfRangeException(nameof(type), type, null),
    };
}
