package dto_astrologer

type ExperienceItem struct {
	Title        string `json:"title" binding:"required"`
	Organization string `json:"organization"`
	StartDate    string `json:"start_date"`
	EndDate      string `json:"end_date"`
	// ExperienceYears is a decimal count of years — 1.5 is eighteen months.
	// It was a uint, which silently truncated a fractional year to 1.
	ExperienceYears float64 `json:"experience_years"`

	// The years and the flag were accepted and dropped: the DTO had no fields
	// for them and the table had no columns. Optional here, unlike the
	// professional block, so a client that only sends a title and a duration
	// keeps working.
	StartYear int  `json:"start_year"`
	EndYear   int  `json:"end_year"`
	IsCurrent bool `json:"is_current"`
	// CurrentlyWorking is the name the app sends; is_current is accepted too.
	// A pointer, so an absent key is distinguishable from an explicit false.
	CurrentlyWorking *bool `json:"currently_working"`

	Description string `json:"description"`
	Certificate string `json:"certificate"`
}

// Working reports whether the astrologer is still in this role, from whichever
// of the two keys the client sent.
func (e ExperienceItem) Working() bool {

	if e.CurrentlyWorking != nil {
		return *e.CurrentlyWorking
	}

	return e.IsCurrent
}

type ExperienceRequest struct {
	Experience []ExperienceItem `json:"experience" binding:"required,dive"`
}
type ExperienceSaveResponse struct {
	CurrentStep int `json:"current_step"`

	CompletionPercentage int `json:"completion_percentage"`

	NextStep int `json:"next_step"`

	NextScreen string `json:"next_screen"`
}
