// Shared types for fullstack project
// Auto-generated — used by both apps/web and apps/api

// ─── Entities ────────────────────────────────────────
export interface User {
  id?: string;
  username: string;
  passwordHash: string;
  nickname?: string;
  role?: string;
  phone?: string;
  avatarUrl?: string;
  createdAt?: string;
  updatedAt?: string;
}

export interface Product {
  id?: string;
  userId: string;
  title: string;
  description?: string;
  price?: number;
  stock?: number;
  images?: Record<string, unknown>;
  createdAt?: string;
  updatedAt?: string;
}

export interface Order {
  id?: string;
  userId: string;
  status?: string;
  totalAmount?: number;
  addressId?: string;
  createdAt?: string;
  updatedAt?: string;
}

export interface Stocktaking {
  id: string;
  userId?: string;
  warehouse?: string;
  productName?: string;
  expectedQty?: number;
  actualQty?: number;
  diff?: number;
  stocktakenAt?: string;
  createdAt?: string;
  updatedAt?: string;
}

export interface Suppliers {
  id: string;
  userId?: string;
  name: string;
  contact?: string;
  phone?: string;
  email?: string;
  address?: string;
  createdAt?: string;
  updatedAt?: string;
}

export interface StockAlerts {
  id: string;
  userId?: string;
  productName: string;
  currentQty?: number;
  threshold?: number;
  alertedAt?: string;
  createdAt?: string;
  updatedAt?: string;
}

// ─── API Response Wrappers ───────────────────────────
export interface ApiResponse<T> {
  data: T;
  message?: string;
}

export interface PaginatedResponse<T> {
  data: T[];
  total: number;
  page: number;
  pageSize: number;
}

export interface ErrorResponse {
  error: string;
  message: string;
  statusCode: number;
}
