export type StockState = 'available' | 'reserved' | 'sold' | 'incoming';

export interface StockItem {
  id: string;
  variantId: string;
  available: number;
  reserved: number;
  sold: number;
  incoming: number;
  createdAt: Date;
  updatedAt: Date;
}

export interface StockCommand {
  variantId: string;
  quantity: number;
}

export type SetAvailableStockCommand = StockCommand;

export interface Availability {
  available: boolean;
  availableQuantity: number;
}

export function assertPositiveQuantity(quantity: number): void {
  if (!Number.isInteger(quantity) || quantity <= 0) {
    throw new Error('Stock quantity must be a positive integer');
  }
}
