// Import and re-export shared entity types
import type {
  User,
  Customers,
  SalesPipeline,
  FollowUps,
  Dashboard,
  ApiResponse,
  PaginatedResponse,
  ErrorResponse,
} from "@shared/types";

export type {
  User,
  Customers,
  SalesPipeline,
  FollowUps,
  Dashboard,
  ApiResponse,
  PaginatedResponse,
  ErrorResponse,
};

// Auto-generated types (from Model Contract)

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 ────────────────────────────────────────────
// ─── JWT ────────────────────────────────────────────
export interface JwtPayload {
  userId: string;
  username: string;
  role: string;
  iat?: number;
  exp?: number;
}
