package modelse

type CodeType int16

/*
|         1           |    0    |    00     |
| 1:language 2:Gateway|  is AOT | code type |
*/
const (
	CodeTypeUnknown    CodeType = -1
	CodeTypeWaitCheck  CodeType = 0
	CodeTypePHP        CodeType = 1001
	CodeTypeJava       CodeType = 1002
	CodeTypeJavaAot    CodeType = 1102
	CodeTypePython     CodeType = 1003
	CodeTypeDotNet     CodeType = 1004
	CodeTypeNode       CodeType = 1005
	CodeTypeGo         CodeType = 1006
	CodeTypeC          CodeType = 1007
	CodeTypeNetCore    CodeType = 1008
	CodeTypeNetCoreAot CodeType = 1108
	CodeTypeLua        CodeType = 1009
	CodeTypeJavaC      CodeType = 1010
	CodeTypeRuby       CodeType = 1012
	CodeTypeNginx      CodeType = 1019
)

func (p CodeType) String() string {
	switch p {
	case CodeTypeGo:
		return "GO"
	case CodeTypeJava:
		return "JAVA"
	case CodeTypeJavaAot:
		return "JAVA_AOT"
	case CodeTypePHP:
		return "PHP"
	case CodeTypePython:
		return "PYTHON"
	case CodeTypeDotNet:
		return "DOTNET"
	case CodeTypeNode:
		return "NODE"
	case CodeTypeC:
		return "C"
	case CodeTypeNetCore:
		return "NETCORE"
	case CodeTypeNetCoreAot:
		return "NETCORE_AOT"
	case CodeTypeLua:
		return "LUA"
	case CodeTypeJavaC:
		return "JAVA_C"
	case CodeTypeRuby:
		return "RUBY"
	case CodeTypeNginx:
		return "NGINX"
	case CodeTypeWaitCheck:
		return "WAIT_CHECK"
	case CodeTypeUnknown:
		return "UNKNOWN:Language"
	default:
		return "UNKNOWN:Language"
	}
}

func (p CodeType) Topic() string {
	switch p {
	case CodeTypeGo:
		return "goTopic"
	case CodeTypeJava:
		return "javaTopic"
	//case CodeTypeJavaAot:
	//	return "JAVA_AOT"
	//case CodeTypePHP:
	//	return "PHP"
	case CodeTypePython:
		return "pythonTopic"
	//case CodeTypeDotNet:
	//	return "DOTNET"
	case CodeTypeNode:
		return "nodeTopic"
	case CodeTypeNginx:
		return "nginxTopic"
	//case CodeTypeC:
	//	return "C"
	//case CodeTypeNetCore:
	//	return "NETCORE"
	//case CodeTypeNetCoreAot:
	//	return "NETCORE_AOT"
	//case CodeTypeLua:
	//	return "LUA"
	//case CodeTypeJavaC:
	//	return "JAVA_C"
	//case CodeTypeRuby:
	//	return "RUBY"
	//case CodeTypeWaitCheck:
	//	return "WAIT_CHECK"
	//case CodeTypeUnknown:
	//	return "UNKNOWN:Language"
	default:
		return ""
	}
}

func (p CodeType) Int() int {
	return int(p)
}

func (p CodeType) ServiceTypeString() string {
	switch p {
	case CodeTypeGo:
		return "GO"
	case CodeTypeJava:
		return "JAVA"
	case CodeTypeJavaAot:
		return "JAVA"
	case CodeTypePHP:
		return "PHP"
	case CodeTypePython:
		return "PYTHON"
	case CodeTypeDotNet:
		return "DOTNET"
	case CodeTypeNode:
		return "NODEJS"
	case CodeTypeC:
		return "C"
	case CodeTypeNetCore:
		return "NETCORE"
	case CodeTypeNetCoreAot:
		return "NETCORE_AOT"
	case CodeTypeLua:
		return "LUA"
	case CodeTypeJavaC:
		return "JAVA_C"
	case CodeTypeRuby:
		return "RUBY"
	case CodeTypeNginx:
		return "NGINX"
	case CodeTypeWaitCheck:
		return "WAIT_CHECK"
	case CodeTypeUnknown:
		return "UNKNOWN:Language"
	default:
		return "UNKNOWN:Language"
	}
}

func (p CodeType) WhiteCodeString() string {
	switch p {
	case CodeTypeGo:
		return "go"
	case CodeTypeJava:
		return "java"
	//case CodeTypeJavaAot:
	//	return "JAVA_AOT"
	case CodeTypePHP:
		return "php"
	case CodeTypePython:
		return "python"
	//case CodeTypeDotNet:
	//	return "DOTNET"
	case CodeTypeNode:
		return "node"
	case CodeTypeC:
		return "c"
	case CodeTypeNetCore:
		return "dc"
	case CodeTypeNginx:
		return "nginx"
	//case CodeTypeNetCoreAot:
	//	return "NETCORE_AOT"
	//case CodeTypeLua:
	//	return "LUA"
	//case CodeTypeJavaC:
	//	return "JAVA_C"
	//case CodeTypeRuby:
	//	return "RUBY"
	//case CodeTypeWaitCheck:
	//	return "WAIT_CHECK"
	//case CodeTypeUnknown:
	//	return "UNKNOWN:Language"
	default:
		return ""
	}
}

func (p CodeType) IsWaitCheck() bool {
	if p == CodeTypeWaitCheck {
		return true
	}
	return false
}

func (p CodeType) IsUnknownCode() bool {
	if p == CodeTypeUnknown {
		return true
	}
	return false
}

func (p CodeType) IsJvmCode() bool {
	if p == CodeTypeJava {
		return true
	}
	return false
}

func (p CodeType) IsGoCode() bool {
	if p == CodeTypeGo {
		return true
	}
	return false
}

func (p CodeType) IsJavaAotCode() bool {
	if p == CodeTypeJavaAot {
		return true
	}
	return false
}

func (p CodeType) IsNetCoreAotCode() bool {
	if p == CodeTypeNetCoreAot {
		return true
	}
	return false
}

func (p CodeType) IsDotNetCode() bool {
	if p == CodeTypeDotNet {
		return true
	}
	return false
}

func (p CodeType) IsPHPCode() bool {
	if p == CodeTypePHP {
		return true
	}
	return false
}

func (p CodeType) IsNodeCode() bool {
	if p == CodeTypeNode {
		return true
	}
	return false
}

func (p CodeType) IsCCode() bool {
	if p == CodeTypeC {
		return true
	}
	return false
}

func (p CodeType) IsPythonCode() bool {
	if p == CodeTypePython {
		return true
	}
	return false
}

func (p CodeType) IsLuaCode() bool {
	if p == CodeTypeLua {
		return true
	}
	return false
}

func (p CodeType) IsRubyCode() bool {
	if p == CodeTypeRuby {
		return true
	}
	return false
}

func (p CodeType) IsJavaCCode() bool {
	if p == CodeTypeJavaC {
		return true
	}
	return false
}

func (p CodeType) IsNginxCode() bool {
	if p == CodeTypeNginx {
		return true
	}
	return false
}
