export type ReviewRating = 1 | 2 | 3 | 4 | 5

export type ReviewStatus = 'pending' | 'approved' | 'rejected'

export interface Review {
  id: string
  productId: string
  userId: string
  purchaseId: string
  vendorId: string | null
  rating: ReviewRating
  body: string | null
  status: ReviewStatus
  vendorReply: string | null
  createdAt: Date
  updatedAt: Date
}

export interface RatingAggregate {
  productId: string
  avg: number
  count: number
  distribution: Record<ReviewRating, number>
}

export interface VerifiedPurchasePort {
  hasPurchased(userId: string, productId: string, purchaseId: string): Promise<boolean>
}

export interface ModerationAdapter {
  score(text: string): Promise<{ action: 'approve' | 'flag' | 'reject'; score: number }>
}

export type Page<T> = { items: T[]; nextCursor: string | null }

export const REVIEW_LIST_DEFAULT_LIMIT = 20
export const REVIEW_LIST_MAX_LIMIT = 100
