export interface PosSaleLineItem {
  variantId: string;
  productId: string;
  sku: string;
  ean: string | null;
  name: string;
  unitPriceCents: number;
  discountCents: number;
  taxCents: number;
  quantity: number;
}

export type PosPaymentKind = 'cash' | 'card' | 'other';

export interface PosPaymentInput {
  kind: PosPaymentKind;
  amountCents: number;
  /** For cash payments: actual amount given by customer. */
  tenderedCents?: number;
  /** For card: last 4 digits if known. */
  last4?: string;
}

export interface PosSaleInput {
  idempotencyKey: string;
  cashSessionId: string;
  terminalId: string;
  userId: string;
  items: PosSaleLineItem[];
  payments: PosPaymentInput[];
  /** Optional customer ID for loyalty. */
  customerId?: string;
}

export interface PosSaleResult {
  orderId: string;
  idempotencyKey: string;
  totalCents: number;
  items: PosSaleLineItem[];
  payments: PosPaymentResult[];
  createdAt: Date;
}

export interface PosPaymentResult {
  id: string;
  kind: PosPaymentKind;
  amountCents: number;
}
