package models

import "time"

// Job represents a job posting
type Job struct {
	ID        string `json:"id" db:"id"`
	CompanyID string `json:"companyId" db:"company_id"`
	CreatedBy string `json:"createdBy" db:"created_by"`

	// Job Details
	Title       string `json:"title" db:"title"`
	Description string `json:"description" db:"description"`

	// Salary
	SalaryMin        *float64 `json:"salaryMin,omitempty" db:"salary_min"`
	SalaryMax        *float64 `json:"salaryMax,omitempty" db:"salary_max"`
	SalaryType       *string  `json:"salaryType,omitempty" db:"salary_type"`   // hourly, daily, weekly, monthly, yearly
	Currency         *string  `json:"currency,omitempty" db:"currency"`        // BRL, USD, EUR, GBP, JPY
	SalaryNegotiable bool     `json:"salaryNegotiable" db:"salary_negotiable"` // Candidate proposes salary

	// Employment
	EmploymentType *string `json:"employmentType,omitempty" db:"employment_type"` // full-time, part-time, dispatch, contract
	WorkMode       *string `json:"workMode,omitempty" db:"work_mode"`             // onsite, hybrid, remote
	WorkingHours   *string `json:"workingHours,omitempty" db:"working_hours"`

	// Location
	Location *string `json:"location,omitempty" db:"location"`
	RegionID *int    `json:"regionId,omitempty" db:"region_id"`
	CityID   *int    `json:"cityId,omitempty" db:"city_id"`

	// Requirements & Benefits (JSONB arrays)
	Requirements JSONMap `json:"requirements,omitempty" db:"requirements"`
	Benefits     JSONMap `json:"benefits,omitempty" db:"benefits"`

	// Visa & Language
	VisaSupport   bool    `json:"visaSupport" db:"visa_support"`
	LanguageLevel *string `json:"languageLevel,omitempty" db:"language_level"` // N5-N1, beginner, none

	// Status
	Status     string `json:"status" db:"status"`          // draft, review, published, paused, expired, archived, reported, open, closed
	IsFeatured bool   `json:"isFeatured" db:"is_featured"` // Featured job flag

	// Metadata
	CreatedAt time.Time `json:"createdAt" db:"created_at"`
	UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
}

// JobWithCompany includes company information
type JobWithCompany struct {
	Job
	CompanyName       string  `json:"companyName"`
	CompanyLogoURL    *string `json:"companyLogoUrl,omitempty"`
	RegionName        *string `json:"regionName,omitempty"`
	CityName          *string `json:"cityName,omitempty"`
	ApplicationsCount int     `json:"applicationsCount"`
}
