/**
 * Shared TypeScript type definitions for backend
 * 
 * Purpose: Centralized type definitions used across controllers, services, and models
 * Ensures type safety and consistency throughout the backend codebase
 */

// User types
export interface User {
  id: number;
  username: string;
  email: string;
  role: 'admin' | 'customer';
  createdAt: Date;
  updatedAt: Date;
}

export interface AuthPayload {
  userId: number;
  username: string;
  role: string;
}

// Product types
export interface Product {
  id: number;
  name: string;
  description: string;
  price: number;
  category: string;
  stock: number;
  images: string[];
  createdAt: Date;
  updatedAt: Date;
}

// API Response types
export interface ApiResponse<T = any> {
  success: boolean;
  data?: T;
  error?: string;
  message?: string;
}

// Request types (extends Express Request)
export interface AuthRequest extends Request {
  user?: AuthPayload;
}
