package contract

import "fmt"

type ResponseError struct {
	Code   string `json:"code"`
	Entity string `json:"entity"`
	Cause  string `json:"cause"`
}

func NewResponseError(code, entity, cause string) *ResponseError {
	return &ResponseError{
		Code:   code,
		Cause:  cause,
		Entity: entity,
	}
}

func (e *ResponseError) GetCode() string {
	return e.Code
}

func (e *ResponseError) GetEntity() string {
	return e.Entity
}

func (e *ResponseError) GetCause() string {
	return e.Cause
}

func (e *ResponseError) Error() string {
	return fmt.Sprintf("%s: %s: %s", e.GetCode(), e.GetEntity(), e.GetCause())
}
