package dto

import "github.com/tidbcloud/pov-service/internal/common/params"

type ErrorDetail struct {
	Type     string `json:"@type"`
	Reason   string `json:"reason"`
	Domain   string `json:"domain"`
	Metadata any    `json:"metadata"`
}

type ErrorResp struct {
	Code    int           `json:"code"`
	Message string        `json:"message"`
	Details []ErrorDetail `json:"details,omitempty"`
}

func (e *ErrorResp) AddDetail(detail ErrorDetail) {
	e.Details = append(e.Details, detail)
}

type ListReq struct {
	Sort     params.Sort `json:"sort" query:"sort"`
	PageSize int         `json:"pageSize" query:"pageSize"`
	OrderBy  string      `json:"orderBy" query:"orderBy"`

	Page int `json:"page" query:"page"`
}

type PageResp struct {
	TotalSize int `json:"totalSize"`
	Page      int `json:"page"`
	PageSize  int `json:"pageSize"`
}
