package response

type Severity string

const (
	errorMessage   Severity = "error"
	warningMessage Severity = "warning"
	infoMessage    Severity = "info"
)

type Message struct {
	Severity Severity `json:"severity"`
	Message  string   `json:"message"`
}

func newMessage() Message {
	return Message{
		Severity: "",
		Message:  "",
	}
}

func (m *Message) SetMessage(severity Severity, message string) {
	if message == "" {
		return
	}
	m.Severity = severity
	m.Message = message
}

func (m *Message) IsError() bool {
	return m.Severity == errorMessage
}
