package services

const (
	CODE_FAIL = 0
	CODE_SUCC = 1
)

func ErrResp(msg string) map[string]any {
	return map[string]any{"code": CODE_FAIL, "msg": msg}
}

func DataResp(data any) map[string]any {
	return map[string]any{"code": CODE_SUCC, "data": data}
}

func SuccMessageResp() map[string]any {
	return map[string]any{"code": CODE_SUCC, "msg": "success"}
}

func TotalResp(total int64) map[string]any {
	return map[string]any{"code": CODE_SUCC, "total": total}
}

func TotalDataResp(data any, total any) map[string]any {
	return map[string]any{"code": CODE_SUCC, "data": data, "total": total}
}

func SuccResp(va map[string]any) map[string]any {
	resp := make(map[string]any)
	resp["code"] = CODE_SUCC
	for k, v := range va {
		resp[k] = v
	}
	return resp
}
