import type { FilterGroup, Product } from "@sheikbras/domain";
/** Formatos devolvidos pela API (contrato em docs/API.md). Preços em centavos. */
export interface Address { cep: string; rua: string; num: string; comp?: string; bairro: string; cidade: string; uf: string }
export interface Tokens { accessToken: string; refreshToken: string; expiresIn: number }
export interface ApiUser { id: string; name: string; email: string; role: "customer" | "seller" | "admin"; mfaEnabled: boolean }
export interface AuthResult { user: ApiUser; tokens: Tokens }
export interface SearchResult { total: number; items: Product[]; filters: FilterGroup[] }
export type OrderStatus = "awaiting_payment" | "paid" | "preparing" | "shipped" | "delivered" | "cancelled";
export interface OrderItem { productId: number; title: string; priceCents: number; qty: number; art: string; imageUrl?: string | null }
export interface OrderDto {
  id: string; paymentId: string; buyerId: string; sellerId: string; items: OrderItem[]; address: Address; shipping: { method: "std" | "exp"; carrier: string; daysMin: number; daysMax: number };
  subtotalCents: number; couponCents: number; pixDiscountCents: number; shippingCents: number; totalCents: number; status: OrderStatus; tracking: { carrier: string; code: string } | null; cancelReason?: string;
  history: { status: OrderStatus; at: string; by: string }[]; createdAt: string; updatedAt: string; commissionCents?: number; sellerNetCents?: number;
}
export interface PaymentDto { id: string; method: "pix" | "card" | "boleto"; status: "pending" | "paid" | "failed" | "refunded"; amountCents: number; pixCode?: string; boletoUrl?: string; expiresAt: string }
export interface PlaceOrderBody { items: { productId: number; qty: number }[]; address: Address; shipMethod: "std" | "exp"; payMethod: "pix" | "card" | "boleto"; installments?: number; cardToken?: string; coupon?: string }
export interface QuoteGroup { sellerId: string; subtotalCents: number; options: { method: "std" | "exp"; carrier: string; cents: number; daysMin: number; daysMax: number }[] }
export interface ReviewDto { id: string; rating: number; text: string; author: string; createdAt: string; verifiedPurchase: boolean; reply: { text: string; at: string } | null }
export interface FinanceSummary { releasedCents: number; toReleaseCents: number; inProgressCents: number; commissionCents: number; grossCents: number; releaseDays: number; lines: { orderId: string; at: string; grossCents: number; commissionCents: number; netCents: number; state: "in_progress" | "to_release" | "released" }[] }
export interface ProductInput { title: string; priceCents: number; originalPriceCents?: number; installments: number; category: string; brand: string; attrs: Record<string, string | number | boolean>; freeShipping: boolean; eta?: string; stock: number; imageUrl?: string | null; weightG?: number }
export interface SellerApplication { type: "PF" | "PJ"; document: string; legalName: string; tradeName: string; phone: string; address: Address }
export type Device = "desktop" | "tablet" | "mobile";
export interface BannerDto { id: string; title: string; subtitle: string; cta: string; link: string; theme: "lav" | "sand" | "white"; art: string; images: Partial<Record<Device, string>> }
export interface HomeDto { banners: BannerDto[]; offers: Product[]; bestsellers: Product[]; recommended: Product[] }
export interface NotificationDto { id: string; type: string; title: string; body: string; link?: string; createdAt: string; read: boolean }
export type ReturnReason = "arrependimento" | "defeito" | "diferente" | "nao_recebido" | "outro";
export interface ReturnDto { id: string; orderId: string; reason: ReturnReason; description: string; status: "requested" | "approved" | "rejected" | "received" | "refunded" | "disputed" | "closed"; refundCents: number; sellerNote?: string; adminNote?: string; createdAt: string; updatedAt: string }
export interface Metrics { gmvCents: number; orders: number; avgTicketCents: number; commissionCents: number; platformSubsidyCents: number; netRevenueCents: number; activeSellers: number; pendingSellers: number; daily: { day: string; cents: number }[] }
export interface BannerInput { slot?: "hero" | "secondary" | "strip"; title: string; subtitle?: string; cta: string; link: string; startsAt: string; endsAt: string; devices: Device[]; priority?: number; theme?: "lav" | "sand" | "white"; art?: string; images?: Partial<Record<Device, string>> }
export interface CouponInput { code: string; pct: number; fundedBy?: "platform" | "seller"; sellerId?: string; maxUses: number; expiresAt: string; firstPurchaseOnly?: boolean }
