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_SIP_PROCESSOR = ICS_ERROR_COMMON + 3000
	ICS_ERROR_NET           = ICS_ERROR_COMMON + 4000
	ICS_ERROR_RECORDDATA    = ICS_ERROR_COMMON + 4500
	ICS_ERROR_SIP_PARSER    = ICS_ERROR_COMMON + 5000
	ICS_ERROR_SDP_PARSER    = ICS_ERROR_COMMON + 5500
	ICS_ERROR_RTP_PARSER    = ICS_ERROR_COMMON + 6000
	ICS_ERROR_DTMF          = ICS_ERROR_COMMON + 6500
	ICS_ERROR_CONV          = ICS_ERROR_COMMON + 7000
	ICS_ERROR_SESS          = ICS_ERROR_COMMON + 8000
	ICS_ERROR_EVENT         = ICS_ERROR_COMMON + 9000
)

//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_STRING_CONV
	ICS_ERROR_DAEMONIZE
	ICS_ERROR_UNKNOWN
)

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("File Open Error", ICS_ERROR_MAKE_DIR)
	ICSERRStrConv      = NewIcsError("Atoi Error", ICS_ERROR_STRING_CONV)
	ICSERRDeamonize    = NewIcsError("Process Deamonize Error", ICS_ERROR_DAEMONIZE)
	ICSERRUnkown       = NewIcsError("Unknown Error", ICS_ERROR_UNKNOWN)
)

//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
	ICS_ERROR_SVC_NOT_INIT
)

var (
	ICSERRSVCTime = NewIcsError("icsservice: Wrong time", ICS_ERROR_SVC_WRONG_TIME)
	ICSERRSVCInit = NewIcsError("icsapp: Not init service", ICS_ERROR_SVC_NOT_INIT)
)

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

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

/*
//sip processor error
const (
	ICS_ERROR_PCAP_OPENLIVE = iota + ICS_ERROR_PCAP
	ICS_ERROR_PCAP_SETFILTER
	ICS_ERROR_PCAP_EOF
)

var (
	ICSERRPCAPOpenLive  = NewIcsError("icspcap: OpenLive Error", ICS_ERROR_PCAP_OPENLIVE)
	ICSERRPCAPSetFilter = NewIcsError("icspcap: Set filter Error", ICS_ERROR_PCAP_SETFILTER)
	ICSERRPCAPEOF       = NewIcsError("icspcap: Packet EOF", ICS_ERROR_PCAP_EOF)
)
*/

//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)
)

//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 not be RTP", ICS_ERROR_RTP_NO)
)

//dtmf parser error
const (
	ICS_ERROR_DTMF_OK = iota + ICS_ERROR_DTMF
	ICS_ERROR_DTMF_CONT
	ICS_ERROR_DTMF_FAIL
)

var (
	ICSERRDTMFOK   = NewIcsError("icsdtmf: Detected DTMF", ICS_ERROR_DTMF_OK)
	ICSERRDTMFCont = NewIcsError("icsdtmf: Processing detect", ICS_ERROR_DTMF_CONT)
	ICSERRDTMFFail = NewIcsError("icsdtmf: Failed detection DTMF", ICS_ERROR_DTMF_FAIL)
)

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

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

//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)
)
