from enum import IntEnum

class AudioSampleFormat(IntEnum):
    AUDIO_PCM_U8 = 0
    AUDIO_PCM_S16 = 1
    AUDIO_PCM_S24 = 2
    AUDIO_PCM_S32 = 3
    AUDIO_PCM_F32 = 4

class DubbingMode(IntEnum):
    NORMAL_MODE = 0
    PRO_MODE = 1

class DubbingMode(IntEnum):
    IDLE = 0
    PREPARING = 1
    PREPARED = 2
    STARTED = 3
    STOPPED = 4
    RELEASED = 5
    ENGINEERROR = 6
    CHECKING = 7
    CALIBRATING = 8

class DubbingAction(IntEnum):
    SET_VOICE = 0
    PREPARE = 1
    CHECK_RESOURCES = 2
    PRO_CALIBRATION = 3
    AUTH = 4


class DubbingRetCode(IntEnum):
    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


def getDubbingRetCodeReason(retCode):
    if retCode == DubbingRetCode.SUCCESS:
        return "Success"
    if retCode == DubbingRetCode.UNKNOWN_ERROR:
        return "Unknown Error"
    if retCode == DubbingRetCode.NET_REQUEST_ERROR:
        return "Net Request Error"
    if retCode == DubbingRetCode.NET_PARSE_ERROR:
        return "Net Parse Error"
    if retCode == DubbingRetCode.NET_AUTH_ERROR:
        return "Net Auth Error"
    if retCode == DubbingRetCode.NET_UPDATE_ERROR:
        return "Net  Update Error"
    if retCode == DubbingRetCode.NET_CODE_ERROR:
        return "Net Code Error"
    if retCode == DubbingRetCode.LIC_NOT_FOUND:
        return "License File Not Found"
    if retCode == DubbingRetCode.LIC_ERROR:
        return "License Content Error"
    if retCode == DubbingRetCode.ENGINE_CREATE_ERROR:
        return "Engline No Create"
    if retCode == DubbingRetCode.ENGINE_TRANSFORM_ERROR:
        return "Engline Transform Error"
    if retCode == DubbingRetCode.ENGINE_PARSE_ERROR:
        return "Engine Parse Error"
    if retCode == DubbingRetCode.ENGINE_DATA_ERROR:
        return "Engine Data Error"
    if retCode == DubbingRetCode.ENGINE_CLIENT_CREATE_ERROR:
        return "Engline Client No Create"
    if retCode == DubbingRetCode.ENGINE_STATUS_ERROR:
        return "Engine Status Error"
    if retCode == DubbingRetCode.RESOURCE_MISSING_FILES:
        return "Resource Missing Files"
    if retCode == DubbingRetCode.RESOURCE_MEMORY_ERROR:
        return "Resource Memory Error"
    if retCode == DubbingRetCode.RESOURCE_CONTENT_ERROR:
        return "Resource Content Error"
    if retCode == DubbingRetCode.RESOURCE_ID_ERROR:
        return "Resource Id Not Found"
    if retCode == DubbingRetCode.VOICE_SETTING:
        return "Voice Setting"
    if retCode == DubbingRetCode.VOICE_NOT_SET:
        return "Voice Is Not Set"
    return "Unknown Error";


