#pragma once

#ifndef DUBBING_BASE_H
#define DUBBING_BASE_H

typedef enum AudioSampleFormat
{
    AUDIO_PCM_U8  = 0,   // signed 8-bit
    AUDIO_PCM_S16 = 1,   // signed 16-bit
    AUDIO_PCM_S24 = 2,   // signed 24-bit in int32, LSB aligned
    AUDIO_PCM_S32 = 3,   // signed 32-bit
    AUDIO_PCM_F32 = 4    // float32 -1.0 ~ 1.0
} AudioSampleFormat;

typedef enum DubbingMode
{
    NORMAL_MODE = 0,    // defalut : normal mode
    PRO_MODE = 1        // pro mode
} DubbingMode;

typedef enum DubbingEngineStatus
{
    IDLE = 0,       // 
    PREPARING,      // Preparing engine resources
    PREPARED,       // Engine resources are ready
    STARTED,        // Starting voice changing
    STOPPED,        // Voice changing stopped
    RELEASED,       // Engine released
    ENGINEERROR,    // Engine error
    CHECKING,       // Checking resource files
    CALIBRATING,    // Calibrating automatically
} DubbingEngineStatus;

typedef enum DubbingAction
{
    SET_VOICE,
    PREPARE,
    CHECK_RESOURCES,
    PRO_CALIBRATION,
    AUTH,
} DubbingAction;

enum DubbingRetCode {
    SUCCESS = 10000,
    UNKNOWN_ERROR = -10000,

    NET_REQUEST_ERROR = -1000,
    NET_PARSE_ERROR = -1001,
    NET_AUTH_ERROR = -1002,
    NET_UPDATE_ERROR = -1003,
    NET_CODE_ERROR = -1004,

    LIC_NOT_FOUND = -2000,
    LIC_ERROR = -2001,

    ENGINE_CREATE_ERROR = -3000,
    ENGINE_TRANSFORM_ERROR = -3001,
    ENGINE_PARSE_ERROR = -3002,
    ENGINE_DATA_ERROR = -3003,
    ENGINE_CLIENT_CREATE_ERROR = -3004,
    ENGINE_STATUS_ERROR = -3005,

    RESOURCE_MISSING_FILES = -4000,
    RESOURCE_MEMORY_ERROR = -4001,
    RESOURCE_CONTENT_ERROR = -4002,
    RESOURCE_ID_ERROR = -4003,

    VOICE_SETTING = -5000,
    VOICE_NOT_SET = -5001,
};

inline const char* getDubbingRetCodeReason(int retCode)
{
    switch (retCode)
    {
    case SUCCESS:
        return "Success";
    case UNKNOWN_ERROR:
        return "Unknown Error";
    case NET_REQUEST_ERROR:
        return "Net Request Error";
    case NET_PARSE_ERROR:
        return "Net Parse Error";
    case NET_AUTH_ERROR:
        return "Net Auth Error";
    case NET_UPDATE_ERROR:
        return "Net  Update Error";
    case NET_CODE_ERROR:
        return "Net Code Error";
    case LIC_NOT_FOUND:
        return "License File Not Found";
    case LIC_ERROR:
        return "License Content Error";
    case ENGINE_CREATE_ERROR:
        return "Engline No Create";
    case ENGINE_TRANSFORM_ERROR:
        return "Engline Transform Error";
    case ENGINE_PARSE_ERROR:
        return "Engine Parse Error";
    case ENGINE_DATA_ERROR:
        return "Engine Data Error";
    case ENGINE_CLIENT_CREATE_ERROR:
        return "Engline Client No Create";
    case ENGINE_STATUS_ERROR:
        return "Engine Status Error";
    case RESOURCE_MISSING_FILES:
        return "Resource Missing Files";
    case RESOURCE_MEMORY_ERROR:
        return "Resource Memory Error";
    case RESOURCE_CONTENT_ERROR:
        return "Resource Content Error";
    case RESOURCE_ID_ERROR:
        return "Resource Id Not Found";
    case VOICE_SETTING:
        return "Voice Setting";
    case VOICE_NOT_SET:
        return "Voice Is Not Set";
    default:
        break;
    }
    return "Unknown Error";
}

#endif