package icserror

const (
	ICS_ERROR_COMMON        = iota
	ICS_ERROR_CONFIG        = ICS_ERROR_COMMON + 1000
	ICS_ERROR_SVC           = ICS_ERROR_COMMON + 2000
	ICS_ERROR_UTIL          = ICS_ERROR_COMMON + 2500
	ICS_ERROR_APP           = ICS_ERROR_COMMON + 3000
	ICS_ERROR_NET           = ICS_ERROR_COMMON + 4000
	ICS_ERROR_RECORDDATA    = ICS_ERROR_COMMON + 4500
	ICS_ERROR_TTS           = ICS_ERROR_COMMON + 5000
	ICS_ERROR_STT           = ICS_ERROR_COMMON + 5500
	ICS_ERROR_WEBSOCKET     = ICS_ERROR_COMMON + 6000
	ICS_ERROR_SIP_PARSER    = ICS_ERROR_COMMON + 6500
	ICS_ERROR_SDP_PARSER    = ICS_ERROR_COMMON + 7000
	ICS_ERROR_RTP_PARSER    = ICS_ERROR_COMMON + 7500
	ICS_ERROR_CONV          = ICS_ERROR_COMMON + 8000
	ICS_ERROR_SESS          = ICS_ERROR_COMMON + 8500
	ICS_ERROR_EVENT         = ICS_ERROR_COMMON + 9000
	ICS_ERROR_HTTP_CLIENT   = ICS_ERROR_COMMON + 9500
	ICS_ERROR_STTMSG_PARSER = ICS_ERROR_COMMON + 10000
	ICS_ERROR_STTUDP_PARSER = ICS_ERROR_COMMON + 10500
	ICS_ERROR_TTS_PARSER    = ICS_ERROR_COMMON + 11000
)

//common error
const (
	ICSOK = iota + ICS_ERROR_COMMON
	ICSFALSE
	ICS_ERROR_NOTFOUND_HOME
	ICS_ERROR_INVALID_PARAM
	ICS_ERROR_FILE_OPEN
	ICS_ERROR_MAKE_DIR
	ICS_ERROR_WRITE_TILE
	ICS_ERROR_STRING_CONV
	ICS_ERROR_DAEMONIZE
)

var (
	ICSERRTest         = NewIcsError("This Is Error Test", ICSOK)
	ICSERRNotFoundHome = NewIcsError("Not found HOME Directory", ICS_ERROR_NOTFOUND_HOME)
	ICSERRInvalidParam = NewIcsError("Invalid Parameter", ICS_ERROR_INVALID_PARAM)
	ICSERRFileOpen     = NewIcsError("File Open Error", ICS_ERROR_FILE_OPEN)
	ICSERRMakeDir      = NewIcsError("Make Dir Error", ICS_ERROR_MAKE_DIR)
	ICSERRWriteFile    = NewIcsError("File Write Error", ICS_ERROR_WRITE_TILE)
	ICSERRStrConv      = NewIcsError("Atoi Error", ICS_ERROR_STRING_CONV)
	ICSERRDeamonize    = NewIcsError("Process Deamonize Error", ICS_ERROR_DAEMONIZE)
)

//config error
const (
	ICS_ERROR_CONFIG_FILE_NOTFOUND = iota + ICS_ERROR_CONFIG
	ICS_ERROR_CONFIG_OPEN_FILE
	ICS_ERROR_CONFIG_UNMARSHAL
)

var (
	ICSERRCONFFileNotFound = NewIcsError("icsconfig: Not Found The Config File ", ICS_ERROR_CONFIG_FILE_NOTFOUND)
	ICSERRCONFOpenFile     = NewIcsError("icsconfig: Configuration File Open Error", ICS_ERROR_CONFIG_OPEN_FILE)
	ICSERRCONFUnmarshal    = NewIcsError("icsconfig: Config File Unmarshal Error", ICS_ERROR_CONFIG_UNMARSHAL)
)

//service error
const (
	ICS_ERROR_SVC_WRONG_TIME = iota + ICS_ERROR_SVC
)

var (
	ICSERRSVCTime = NewIcsError("icsservice: Wrong time", ICS_ERROR_SVC_WRONG_TIME)
)

//util error
const (
	ICS_ERROR_UTIL_DISK_FULL = iota + ICS_ERROR_UTIL
)

var (
	ICSERRUTILDiskFull = NewIcsError("icsutil: Disk Full", ICS_ERROR_UTIL_DISK_FULL)
)

//app error
const (
	ICS_ERROR_APP_HTTP = iota + ICS_ERROR_APP
)

var (
	ICSERRAPPHTTP = NewIcsError("icsapp: HTTP Listen", ICS_ERROR_APP_HTTP)
)

//net error
const (
	ICS_ERROR_NET_RESOLVEADDR = iota + ICS_ERROR_NET
	ICS_ERROR_NET_LISTEN
	ICS_ERROR_NET_CONNECT
	ICS_ERROR_NET_NOT_CONNECTED
	ICS_ERROR_NET_CLOSE
	ICS_ERROR_NET_WRITE
	ICS_ERROR_NET_READ
	ICS_ERROR_NET_ACCEPT
	ICS_ERROR_NET_NOT_FOUND_IF
	ICS_ERROR_NET_GET_ADDR
)

var (
	ICSERRNETResolveAddrError = NewIcsError("icsnet: Resolve Address Error", ICS_ERROR_NET_RESOLVEADDR)
	ICSERRNETListenError      = NewIcsError("icsnet: Listen Error", ICS_ERROR_NET_LISTEN)
	ICSERRNETConnectError     = NewIcsError("icsnet: Connect Error", ICS_ERROR_NET_CONNECT)
	ICSERRNETNotConnectError  = NewIcsError("icsnet: Connection is not completed yet", ICS_ERROR_NET_NOT_CONNECTED)
	ICSERRNETCloseError       = NewIcsError("icsnet: Close Error", ICS_ERROR_NET_CLOSE)
	ICSERRNETWriteError       = NewIcsError("icsnet: Write Error", ICS_ERROR_NET_WRITE)
	ICSERRNETReadError        = NewIcsError("icsnet: Read Error", ICS_ERROR_NET_READ)
	ICSERRNETAcceptError      = NewIcsError("icsnet: Accept Error", ICS_ERROR_NET_ACCEPT)
	ICSERRNETNotFoundIF       = NewIcsError("icsnet: Not Found Interface", ICS_ERROR_NET_NOT_FOUND_IF)
	ICSERRNETGetAddr          = NewIcsError("icsnet: Could Not Get Address", ICS_ERROR_NET_GET_ADDR)
)

//recorddata error
const (
	ICS_ERROR_RECORDDATA_CALLSIGNAL_PARSING = iota + ICS_ERROR_RECORDDATA
)

var (
	ICSERRRECORDDATAParsing = NewIcsError("recorddata: Parsing Error", ICS_ERROR_RECORDDATA_CALLSIGNAL_PARSING)
)

//tts error
const (
	ICS_ERROR_TTS_CONTINUE = iota + ICS_ERROR_TTS
	ICS_ERROR_TTS_OK
	ICS_ERROR_TTS_FAIL
	ICS_ERROR_TTS_FAIL_EMPTY
	ICS_ERROR_TTS_FAIL_INITIALIZE
	ICS_ERROR_TTS_NOT_INITIALIZE
)

var (
	ICSERRTTSContinue  = NewIcsError("tts: Processing Synthesis", ICS_ERROR_TTS_CONTINUE)
	ICSERRTTSOK        = NewIcsError("tts: Synthesis Completed", ICS_ERROR_TTS_OK)
	ICSERRTTSFail      = NewIcsError("tts: Synthesis Failed", ICS_ERROR_TTS_FAIL)
	ICSERRTTSFailEmpty = NewIcsError("tts: Synthesis Failed. No Voice", ICS_ERROR_TTS_FAIL_EMPTY)
	ICSERRTTSFailInit  = NewIcsError("tts: Initialized Error", ICS_ERROR_TTS_FAIL_INITIALIZE)
	ICSERRTTSNotInit   = NewIcsError("tts: Not Initialized ", ICS_ERROR_TTS_NOT_INITIALIZE)
)

//stt error
const (
	ICS_ERROR_STT_CONTINUE = iota + ICS_ERROR_STT
	ICS_ERROR_STT_BARGEIN
	ICS_ERROR_STT_OK
	ICS_ERROR_STT_FAIL
	ICS_ERROR_STT_FAIL_EMPTY
	ICS_ERROR_STT_SEND_FAIL
	ICS_ERROR_STT_FAIL_INITIALIZE
	ICS_ERROR_STT_CONNECT_TIMEOUT
	ICS_ERROR_STT_NOT_INITIALIZE
)

var (
	ICSERRSTTContinue       = NewIcsError("stt: Processing Recognition", ICS_ERROR_STT_CONTINUE)
	ICSERRSTTBargeIn        = NewIcsError("stt: Barge-In Occurred", ICS_ERROR_STT_BARGEIN)
	ICSERRSTTOK             = NewIcsError("stt: Recognition Completed", ICS_ERROR_STT_OK)
	ICSERRSTTFail           = NewIcsError("stt: Recoognition Failed", ICS_ERROR_STT_FAIL)
	ICSERRSTTFailEmpty      = NewIcsError("stt: Recoognition Failed. No Voice", ICS_ERROR_STT_FAIL_EMPTY)
	ICSERRSTTSendFail       = NewIcsError("stt: Initialized Error", ICS_ERROR_STT_SEND_FAIL)
	ICSERRSTTFailInit       = NewIcsError("stt: Initialized Error", ICS_ERROR_STT_FAIL_INITIALIZE)
	ICSERRSTTConnectTimeout = NewIcsError("stt: Initialized Error", ICS_ERROR_STT_CONNECT_TIMEOUT)
	ICSERRSTTNotInit        = NewIcsError("stt: Not Initialized ", ICS_ERROR_STT_NOT_INITIALIZE)
)

//websocket error
const (
	ICS_ERROR_WEBSOCKET_CONNECT_FAIL = iota + ICS_ERROR_WEBSOCKET
	ICS_ERROR_WEBSOCKET_NOT_CONNECT
	ICS_ERROR_WEBSOCKET_CLOSE
	ICS_ERROR_WEBSOCKET_READ
	ICS_ERROR_WEBSOCKET_WRITE
	ICS_ERROR_WEBSOCKET_NOT_SUPPORTED_MSG_TYPE
)

var (
	ICSERRWEBSOCKETConnectFailError = NewIcsError("icsws: Failed to Connect to host", ICS_ERROR_WEBSOCKET_CONNECT_FAIL)
	ICSERRWEBSOCKETNotConnectError  = NewIcsError("icsws: Not Connected Yet", ICS_ERROR_WEBSOCKET_NOT_CONNECT)
	ICSERRWEBSOCKETNotClose         = NewIcsError("icsws: Could Not Close", ICS_ERROR_WEBSOCKET_CLOSE)
	ICSERRWEBSOCKETReadError        = NewIcsError("icsws: Failed to Read", ICS_ERROR_WEBSOCKET_READ)
	ICSERRWEBSOCKETWriteError       = NewIcsError("icsws: Failed to Write", ICS_ERROR_WEBSOCKET_WRITE)
	ICSERRWEBSOCKETSupportedMsgType = NewIcsError("icsws: Failed to Write", ICS_ERROR_WEBSOCKET_NOT_SUPPORTED_MSG_TYPE)
)

//sip parsing error
var (
	ICSERRSIPHeader      = NewIcsError("icssip: Header format Error", ICS_ERROR_SIP_PARSER)
	ICSERRINVITERequired = NewIcsError("icssip: INVITE Method required SDP", ICS_ERROR_SIP_PARSER)
	ICSERR200OKRequired  = NewIcsError("icssip: 200 OK Method required SDP", ICS_ERROR_SIP_PARSER)
)

//sdp parsing error
var (
	ICSERRSDPParser            = NewIcsError("icssdp: Data parser Error", ICS_ERROR_SDP_PARSER)
	ICSERRNotFoundSdpMedia     = NewIcsError("icssdp: Not Found SDP Media audio tag", ICS_ERROR_SDP_PARSER)
	ICSERRSDPAudiotagPortValue = NewIcsError("icssdp: SDP Media audio tag port is not numeric", ICS_ERROR_SDP_PARSER)
)

//rtp parser error
const (
	ICS_ERROR_RTP_NO = iota + ICS_ERROR_RTP_PARSER
)

var (
	ICSERRRTPNo = NewIcsError("icsrtp: This packet may be not RTP", ICS_ERROR_RTP_NO)
)

//media converter error
const (
	ICS_ERROR_CONV_NOT_SUPPORTED_CODEC = iota + ICS_ERROR_CONV
	ICS_ERROR_CONV_DECODE
)

var (
	ICSERRCONVNotSupportedCodec = NewIcsError("icsmediaconv: Not Supported codec", ICS_ERROR_CONV_NOT_SUPPORTED_CODEC)
	ICSERRCONVDecodeFail        = NewIcsError("icsmediaconv: Decoding Fail", ICS_ERROR_CONV_DECODE)
)

//session error
const (
	ICS_ERROR_SESS_NOT_FOUND_SESSION = iota + ICS_ERROR_SESS
	ICS_ERROR_SESS_SESSION_MAX_IDLE
	ICS_ERROR_SESS_SESSION_NUM_EXCEED
)

var (
	ICSERRSESSNotFoundSession  = NewIcsError("icssessionmanager: Not Found Session", ICS_ERROR_SESS_NOT_FOUND_SESSION)
	ICSERRSESSMaxSessionIdle   = NewIcsError("icssessionmanager: Exceeded Session Max Idling Time", ICS_ERROR_SESS_SESSION_MAX_IDLE)
	ICSERRSESSMaxSessionNumber = NewIcsError("icssessionmanager: Licensed Channel Number Exceeded ", ICS_ERROR_SESS_SESSION_NUM_EXCEED)
)

//event error
const (
	ICS_ERROR_EVT_ALLOC = iota + ICS_ERROR_EVENT
	ICS_ERROR_EVT_REMOVE
	ICS_ERROR_EVT_POST
	ICS_ERROR_EVT_NOT_INITIALIZE
	ICS_ERROR_EVT_UNKNOWN
)

var (
	ICSERREVTAlloc   = NewIcsError("icsevent: Event Allocation Error", ICS_ERROR_EVT_ALLOC)
	ICSERREVTRemove  = NewIcsError("icsevent: Event Remove Error", ICS_ERROR_EVT_REMOVE)
	ICSERREVTPost    = NewIcsError("icsevent: Event Post Error", ICS_ERROR_EVT_POST)
	ICSERREVTNotInit = NewIcsError("icsevent: Event System Not Initialized", ICS_ERROR_EVT_NOT_INITIALIZE)
	ICSERREVTUnkown  = NewIcsError("icsevent: Unkown Error", ICS_ERROR_EVT_UNKNOWN)
)

//http client
const (
	ICS_ERROR_HTTP_CLIENT_RESPONSE = iota + ICS_ERROR_HTTP_CLIENT
)

var (
	ICSERRHTTPClientResponse = NewIcsError("icshttpclient: No Response", ICS_ERROR_HTTP_CLIENT_RESPONSE)
)
