package dto_astrologer

type UpdateExperienceItem struct {
	Title string `json:"title" binding:"required"`
	// Decimal years, same as ExperienceItem.ExperienceYears.
	ExperienceYears float64 `json:"experience_years"`

	// Same three fields the save endpoint takes, and previously dropped here
	// too. See ExperienceItem for why currently_working is a pointer.
	StartYear        int   `json:"start_year"`
	EndYear          int   `json:"end_year"`
	IsCurrent        bool  `json:"is_current"`
	CurrentlyWorking *bool `json:"currently_working"`

	Description string `json:"description"`
}

// Working reports whether the astrologer is still in this role.
func (e UpdateExperienceItem) Working() bool {

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

	return e.IsCurrent
}

type UpdateExperienceRequest struct {
	Experiences []UpdateExperienceItem `json:"experiences" binding:"omitempty,dive"`
}
