package dto_astrologer

type ProfessionalItem struct {
	Occupation string `json:"occupation"`
	// Designation is the name UpdateProfessionalItem uses for the same column.
	// Both keys are accepted here so a client does not have to know which
	// endpoint it is talking to; Role() picks whichever arrived.
	Designation           string `json:"designation"`
	EmploymentType        string `json:"employment_type"`
	CurrentCompany        string `json:"current_company"`
	CompanyName           string `json:"company_name"`
	ConsultationMode      string `json:"consultation_mode"`
	JoiningDate           string `json:"joining_date"`
	ExperienceCertificate string `json:"experience_certificate"`

	// ExperienceYears is a decimal count of years — 2.5 is two and a half.
	// It was an int, which rejected the fraction outright.
	ExperienceYears float64 `json:"experience_years"`

	StartYear int `json:"start_year"`
	EndYear   int `json:"end_year"`
	// CurrentlyWorking is a pointer so a missing key is distinguishable from an
	// explicit false — `binding:"required"` on a bool would reject false, which
	// is a legitimate answer.
	CurrentlyWorking *bool `json:"currently_working"`
}

// Company is the company name, whichever of the two keys the client sent.
func (p ProfessionalItem) Company() string {

	if p.CurrentCompany != "" {
		return p.CurrentCompany
	}

	return p.CompanyName
}

// Role is the designation/occupation, whichever of the two keys the client sent.
func (p ProfessionalItem) Role() string {

	if p.Occupation != "" {
		return p.Occupation
	}

	return p.Designation
}

type ProfessionalRequest struct {
	Professionals []ProfessionalItem `json:"professionals" binding:"required,min=1"`
}

type ProfessionalSaveResponse struct {
	CurrentStep          int    `json:"current_step"`
	CompletionPercentage int    `json:"completion_percentage"`
	NextStep             int    `json:"next_step"`
	NextScreen           string `json:"next_screen"`
}
