package response

import (
	"context"
	"encoding/json"
	"net/http"
)

func ResponseWithErrorCode(ctx context.Context, w http.ResponseWriter,
	err error, code string, statusCode int, message string) {
	setDefaultHeaders(ctx, w.Header())

	w.WriteHeader(statusCode)

	b, _ := json.Marshal(ErrorResponse{
		Error: ErrorResponseData{
			Code:    code,
			Message: message,
		},
	})

	w.Write(b)
}
