/**
 * Job Types - Shared between frontend and backend
 */

/** Job status */
export type JobStatus = 'active' | 'completed' | 'pending' | 'cancelled' | 'Active' | 'Completed' | 'Pending' | 'On Hold';

/** Job record from PocketBase */
export interface Job {
  id: string;
  job_number: string;
  job_name: string;
  client_name: string;
  status: JobStatus;
  site_id?: string;
  drive_id?: string;
  folder_path?: string;
  created: string;
  updated: string;
  // Computed/alias properties for frontend convenience
  jobNumber?: string;
  customer?: string;
  address?: string;
  createdAt?: string;
  updatedAt?: string;
  notes?: StickyNote[];
}

/** Job file from SharePoint/Graph API */
export interface JobFile {
  id: string;
  name: string;
  size: number;
  mimeType: string;
  webUrl: string;
  downloadUrl?: string;
  createdDateTime: string;
  lastModifiedDateTime: string;
  createdBy?: {
    user: {
      displayName: string;
      email: string;
    };
  };
  lastModifiedBy?: {
    user: {
      displayName: string;
      email: string;
    };
  };
}

/** Job files response */
export interface JobFilesResponse {
  jobId: string;
  files: JobFile[];
  nextLink?: string;
  cached: boolean;
}

/** Sticky note for a job */
export interface StickyNote {
  id: string;
  job_id: string;
  content: string;
  color?: 'yellow' | 'blue' | 'green' | 'pink' | 'purple';
  position_x?: number;
  position_y?: number;
  created: string;
  updated: string;
  created_by: string;
  // Alias for frontend
  createdAt?: string;
}

/** Job list response */
export interface JobListResponse {
  jobs: Job[];
  page: number;
  perPage: number;
  totalItems: number;
  totalPages: number;
}

/** Job detail response */
export interface JobDetailResponse {
  job: Job;
  files: JobFile[];
  notes: StickyNote[];
}
