using System.ComponentModel;

namespace SHH.CameraSdk;

/// <summary>
/// 工业级相机归一化错误码 (修正全量版)
/// 职责：跨厂家建立统一故障语义，支撑 HikErrorMapper 等驱动层的精准映射。
/// </summary>
public enum CameraErrorCode
{
    [Description("操作成功")]
    Success = 0,

    #region --- 1000-1499 运行环境与 SDK 基础故障 ---

    [Description("SDK 未初始化")]
    SdkNotInitialized = 1000,

    [Description("SDK 资源分配错误或本地内存不足")]
    LocalResourceError = 1001,

    [Description("加载插件/组件失败：缺少 DLL 或依赖库")]
    ComponentLoadFailed = 1002,

    [Description("组件版本不匹配")]
    ComponentVersionMismatch = 1003,

    [Description("加载加密库失败(Ope nSSL/LibEay32)")]
    EncryptionLibError = 1004, // 已补齐 (海康 156)

    [Description("函数调用顺序错误")]
    FunctionOrderError = 1005,

    [Description("操作系统不支持该功能")]
    OsNotSupported = 1006,

    #endregion

    #region --- 1500-1999 网络通信与协议故障 ---

    [Description("连接设备失败：设备离线")]
    NetworkUnreachable = 1500,

    [Description("交互超时：网络拥塞或设备响应慢")]
    Timeout = 1501,

    [Description("数据发送失败")]
    NetworkSendError = 1502,

    [Description("数据接收失败")]
    NetworkRecvError = 1503,

    [Description("网络套接字(Socket)异常")]
    SocketError = 1504,

    [Description("IP 地址冲突")]
    IpConflict = 1505,

    [Description("端口池耗尽或端口复用失败")]
    PortPoolExhausted = 1506,

    [Description("连接已失效或未建立")]
    InvalidLink = 1507, // 已补齐 (海康 188)

    #endregion

    #region --- 2000-2499 身份认证与权限管理 ---

    [Description("用户名或密码错误")]
    InvalidCredentials = 2000,

    [Description("用户权限不足")]
    AccessDenied = 2001,

    [Description("用户不存在")]
    UserNotExist = 2002,

    [Description("账号已被锁定(多次尝试失败)")]
    AccountLocked = 2003,

    [Description("登录人数已达上限")]
    MaxUserExceeded = 2004,

    [Description("会话已过期或已被强行踢出")]
    SessionExpired = 2005,

    [Description("用户正在使用中(如正在对讲/升级)")]
    UserInUse = 2006, // 已补齐 (海康 74)

    [Description("登录版本过低(不支持该协议)")]
    LoginVersionLow = 2007, // 已补齐 (海康 155)

    #endregion

    #region --- 2500-2999 设备资源与负载限制 ---

    [Description("设备连接数已达上限")]
    MaxConnectionsReached = 2500,

    [Description("设备资源不足或内部忙")]
    DeviceResourceBusy = 2501,

    [Description("通道接入数达到上限")]
    MaxQuantityExceeded = 2502,

    [Description("主/子码流路数超限")]
    MaxStreamExceeded = 2503,

    [Description("设备缓冲区不足/溢出")]
    DeviceBufferOverflow = 2504,

    #endregion

    #region --- 3000-3499 视频预览、回放与解码 ---

    [Description("预览失败或通道未编码")]
    PreviewFailed = 3000,

    [Description("码流封装格式不支持")]
    StreamTypeNotSupport = 3001,

    [Description("码流数据中断(丢包/心跳丢失)")]
    StreamInterrupted = 3002,

    [Description("码流已加密(需二次认证)")]
    StreamEncrypted = 3003,

    [Description("外接 IP 通道离线")]
    IpChannelOffline = 3004,

    [Description("设备通道异常")]
    ChannelException = 3005, // 已补齐 (海康 18)

    [Description("播放库(Player SDK)调用失败")]
    PlayerSdkFailed = 3006, // 已补齐 (海康 51)

    [Description("音频设备忙(声卡被独占)")]
    AudioDeviceBusy = 3007, // 已补齐 (海康 69)

    #endregion

    #region --- 3500-3999 存储管理故障 ---

    [Description("存储设备通用错误")]
    StorageError = 3500,

    [Description("设备无硬盘")]
    NoDisk = 3501,

    [Description("硬盘已满")]
    DiskFull = 3502,

    [Description("硬盘状态异常(格式化中或读写错)")]
    DiskStatusError = 3503,

    [Description("尝试格式化只读硬盘")]
    DiskReadOnly = 3504,

    [Description("存储池/NAS 目录无效")]
    StoragePoolError = 3505,

    [Description("写入存储(Flash/文件)失败")]
    WriteStorageFailed = 3506, // 已补齐 (海康 48, 77)

    #endregion

    #region --- 4000-4499 硬件、参数与系统故障 ---

    [Description("硬件内部故障")]
    HardwareFault = 4000,

    [Description("通道号错误或不存在")]
    InvalidChannel = 4001,

    [Description("参数错误(空指针或无效值)")]
    InvalidParameter = 4002,

    [Description("视频信号丢失(黑屏/丢信号)")]
    VideoSignalLoss = 4003,

    [Description("设备正在重启中")]
    DeviceRebooting = 4004,

    [Description("需重启生效")]
    RebootRequired = 4005,

    [Description("时间输入错误")]
    InvalidTimeInput = 4006, // 已补齐 (海康 32)

    [Description("设备型号或版本不匹配")]
    DeviceMismatch = 4007, // 已补齐 (海康 80)

    #endregion

    #region --- 4500-4999 操作限制与通用状态 ---

    [Description("设备不支持该功能")]
    NotSupported = 4500, // 已补齐 (海康 23)

    [Description("修改或设置失败")]
    ModifyFailed = 4501,

    [Description("不支持无阻塞抓图")]
    CaptureNotSupport = 4502,

    [Description("设备忙")]
    DeviceBusy = 4503,

    [Description("上次操作未完成")]
    OperationNotFinished = 4504,

    #endregion

    #region --- 9000-9999 系统级故障 ---

    [Description("驱动未实现该功能")]
    NotImplemented = 9001,

    [Description("程序异常")]
    ProgramException = 9998,

    [Description("未知错误")]
    Unknown = 9999

    #endregion
}