import * as finance from "../finance/index.js";
import { type TContact } from "./contact.js";

/**
 * Represents the type of employment contract
 */
export type TContractType = 
  | 'full-time' 
  | 'part-time' 
  | 'contract' 
  | 'freelance'
  | 'internship'
  | 'apprenticeship'
  | 'volunteer'
  | 'temporary'
  | 'seasonal';

/**
 * Represents the work location arrangement
 */
export type TWorkLocationType = 
  | 'on-site'
  | 'hybrid'
  | 'remote';

/**
 * Represents the experience level required for the job
 */
export type TExperienceLevel = 
  | 'entry'
  | 'mid'
  | 'senior'
  | 'executive';

/**
 * Represents the status of a job posting
 */
export type TJobStatus = 
  | 'active' 
  | 'closed'
  | 'expired'
  | 'filled'
  | 'archived';

/**
 * Language proficiency levels
 */
export type TLanguageProficiency = 
  | 'basic' 
  | 'intermediate' 
  | 'advanced' 
  | 'native';

/**
 * Represents a language requirement with name and proficiency level
 */
export interface ILanguageRequirement {
  name: string;
  level: TLanguageProficiency;
}

/**
 * Represents salary information with structure if needed
 */
export interface ISalaryInfo {
  min?: number;
  max?: number;
  currency?: finance.TCurrency;
  period?: 'hourly' | 'daily' | 'weekly' | 'monthly' | 'annually';
}

/**
 * Represents a record in the job history
 */
export interface IJobHistory {
  timestamp: string;
  source: string;
  category?: string;
  action?: string;
  details?: string;
}

/**
 * Universal Job Interface representing a job posting
 */
export interface IJob {
  // Core job information
  id: string;
  title: string;
  company: string;
  description: string;
  url: string;
  
  // Location information
  location: string;
  locationType?: TWorkLocationType;
  
  // Dates
  postedDate?: string;
  
  // Compensation
  salary?: ISalaryInfo;
  
  // Classification
  contractType?: TContractType;
  category?: string;
  experienceLevel?: TExperienceLevel;
  
  // Skills and requirements
  skillTags?: string[];
  qualificationTags?: string[];
  languages?: ILanguageRequirement[];
  
  // Contact information
  from?: TContact;
  contact?: TContact;
  
  // Metadata
  source: string;
  status: TJobStatus;
  firstScrapedAt: string;
  lastScrapedAt: string;
  history: IJobHistory[];
}