// Shared response envelope + error shapes mirroring docs/11-BACKEND-PHASE1.md §1.4/§1.8.

export interface PaginationMeta {
  page: number
  pageSize: number
  totalItems: number
  totalPages: number
}

export interface PagedResponse<T> {
  items: T[]
  pagination: PaginationMeta
}

/** A resource plus its concurrency token (docs/11 §1.6 ETag/If-Match), e.g. `vendorsApi.get()`. */
export interface ApiResult<T> {
  data: T
  etag: string | null
}

/** RFC 7807 ProblemDetails shape (docs/11-BACKEND-PHASE1.md §1.8). */
export interface ProblemDetails {
  type?: string
  title: string
  status: number
  /** Stable domain code from the catalog in docs/11-BACKEND-PHASE1.md §7 (e.g. OVER_RECEIPT_TOLERANCE). */
  code?: string
  detail?: string
  traceId?: string
  /** Field -> messages, present on 400 ValidationProblemDetails. */
  errors?: Record<string, string[]>
}

export type EntityStatus = "Active" | "Inactive"
