package response

type MessageCode int

type CodeMessage interface {
	String() string
	Code() int
}

const (
	// HTTP Default Message
	CodeSuccess       MessageCode = 1000
	CodeCreated       MessageCode = 1001
	CodeAccepted      MessageCode = 1002
	CodeNoContent     MessageCode = 1003
	CodeRedirect      MessageCode = 1004
	CodeDataFormat    MessageCode = 1005
	CodeUnauthorized  MessageCode = 1006
	CodeForbidden     MessageCode = 1007
	CodeNotFound      MessageCode = 1008
	CodeInternalError MessageCode = 1009

	// Custom Message
)

func (mc MessageCode) String() string {
	switch mc {
	case CodeSuccess:
		return "Success"
	case CodeCreated:
		return "Created"
	case CodeAccepted:
		return "Accepted"
	case CodeNoContent:
		return "No Content"
	case CodeRedirect:
		return "Moved Permanently"
	case CodeDataFormat:
		return "Data Format Error"
	case CodeUnauthorized:
		return "Unauthorized"
	case CodeForbidden:
		return "Forbidden"
	case CodeNotFound:
		return "Not Found"
	case CodeInternalError:
		return "Internal Error"
	default:
		return ""
	}
}

func (mc MessageCode) Code() int {
	return int(mc)
}

func GetCodeMessage(c MessageCode) (MessageCode, string) {
	return c, c.String()
}
