export type Id = number | string;
export type Role = 'customer' | 'contractor';

export interface User {
  id: Id;
  name: string;
  email: string | null;
  role: Role;
  business_name: string | null;
}

export interface Category {
  id: Id;
  name: string;
  slug: string;
  icon: string;
  image_url?: string;
}

export interface Job {
  id: Id;
  title: string;
  description?: string;
  location: string;
  parish?: string | null;
  budget_min?: string | number | null;
  budget_max?: string | number | null;
  preferred_date?: string | null;
  status: string;
  created_at: string;
  category_name: string;
  bid_count?: number | string;
  customer_name?: string;
  accepted_contractor_name?: string | null;
}

export interface Bid {
  id?: Id;
  bid_id?: Id;
  job_id?: Id;
  contractor_id?: Id;
  amount: string | number;
  message?: string;
  status?: string;
  bid_status?: string;
  job_status?: string;
  title?: string;
  location?: string;
  category_name?: string;
  contractor_name?: string;
  business_name?: string | null;
  created_at?: string;
}

export interface JobDetail {
  job: Job & {
    customer_name?: string;
    accepted_contractor_name?: string | null;
    accepted_business_name?: string | null;
  };
  customer_phone: string | null;
  bids: Bid[];
  has_bid: boolean;
  can_bid: boolean;
  can_accept_bids: boolean;
  can_chat: boolean;
  credits: number | null;
  bid_credit_cost: number | null;
}

export interface ChatMessage {
  id: Id;
  sender_id: Id;
  sender_name: string;
  body: string;
  created_at: string;
}

export interface MeResponse {
  user: User;
  credits: number;
  bid_credit_cost: number;
}
