// Auto-generated types (from Model Contract)

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

export interface Customers {
  id: string;
  userId?: string;
  name: string;
  email?: string;
  phone?: string;
  company?: string;
  source?: string;
  tags?: Record<string, unknown>;
  createdAt?: string;
  updatedAt?: string;
}

export interface SalesPipeline {
  id: string;
  userId?: string;
  customerId?: string;
  stage: string;
  amount?: number;
  probability?: number;
  expectedClose?: string;
  createdAt?: string;
  updatedAt?: string;
}

export interface FollowUps {
  id: string;
  userId?: string;
  customerId?: string;
  type?: string;
  content?: string;
  nextAction?: string;
  nextActionDate?: string;
  createdAt?: string;
  updatedAt?: string;
}

export interface Dashboard {
  id: string;
  userId?: string;
  name: string;
  description?: string;
  color?: string;
  createdAt?: string;
  updatedAt?: string;
}

export interface CreateUserInput {
  username: string;
  passwordHash: string;
  nickname?: string;
  role?: string;
  phone?: string;
  avatarUrl?: string;
}

export interface CreateCustomersInput {
  userId?: string;
  name: string;
  email?: string;
  phone?: string;
  company?: string;
  source?: string;
}

export interface CreateSalesPipelineInput {
  userId?: string;
  customerId?: string;
  stage: string;
  amount?: number;
  probability?: number;
  expectedClose?: string;
}

export interface CreateFollowUpsInput {
  userId?: string;
  customerId?: string;
  type?: string;
  content?: string;
  nextAction?: string;
  nextActionDate?: string;
}

export interface CreateDashboardInput {
  userId?: string;
  name: string;
  description?: string;
  color?: string;
}

export interface UpdateUserInput {
  username?: string;
  passwordHash?: string;
  nickname?: string;
  role?: string;
  phone?: string;
  avatarUrl?: string;
}

export interface UpdateCustomersInput {
  userId?: string;
  name?: string;
  email?: string;
  phone?: string;
  company?: string;
  source?: string;
}

export interface UpdateSalesPipelineInput {
  userId?: string;
  customerId?: string;
  stage?: string;
  amount?: number;
  probability?: number;
  expectedClose?: string;
}

export interface UpdateFollowUpsInput {
  userId?: string;
  customerId?: string;
  type?: string;
  content?: string;
  nextAction?: string;
  nextActionDate?: string;
}

export interface UpdateDashboardInput {
  userId?: string;
  name?: string;
  description?: string;
  color?: string;
}

// ─── Auth ───────────────────────────────────────────
export interface LoginInput {
  username: string;
  password: string;
}

export interface RegisterInput {
  username: string;
  password: string;
  nickname?: string;
}

export interface AuthResponse {
  token: string;
  user: User;
}

// ─── API ────────────────────────────────────────────
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;
}

// ─── JWT ────────────────────────────────────────────
export interface JwtPayload {
  userId: string;
  username: string;
  role: string;
  iat?: number;
  exp?: number;
}
