package dbtypes

import "time"

type VacancyStatus string

const (
	VacUnspecified VacancyStatus = "unspecified"
	VacNew         VacancyStatus = "new"
	VacPending     VacancyStatus = "pending"
	VacApproved    VacancyStatus = "approved"
	VacRejected    VacancyStatus = "rejected"
)

func NewVacancyStatus(status *string) *VacancyStatus {
	if status == nil {
		return nil
	}

	res := VacancyStatus(*status)

	return &res
}

// <=============================>
// 	  	Common Vacancy types
// <=============================>

type (
	Vacancy struct {
		Id                 string
		Company            VacancyCompanyInfo
		Name               string
		Address            string
		WorkFormat         string
		AgentReward        *int32
		SalaryTop          int32
		SalaryBottom       int32
		Requirements       *string
		Responsibilities   *string
		ExtraInfo          *string
		Region             string
		IsArchived         bool
		TargetAction       VacancyTargetAction
		Moderation         VacancyModeration
		RequiredCandidates int32
		CurrentCandidates  int32
		ExtraFields        *string
		CreatedAt          time.Time
	}

	VacancyCompanyInfo struct {
		Id       string
		Name     string
		LogoLink *string
	}

	VacancyTargetAction struct {
		Action   string
		Duration int32
	}

	VacancyModeration struct {
		Status             VacancyStatus
		DescriptionHistory []VacancyModerationDescription
	}

	VacancyModerationDescription struct {
		Description *string
		CreatedAt   time.Time
	}
)

// <=============================>
// 	  	  Get Vacancy List
// <=============================>

type (
	VacancyListGetRequest struct {
		Filters  *VacancyListFilters
		Page     uint64
		PageSize uint64
	}

	VacancyListFilters struct {
		DistributorId *string
		CompanyId     *string
		VacancyId     *string
		Region        *string
		SalaryBottom  *int32
		SalaryTop     *int32
		IsArchived    *bool
		Status        *VacancyStatus
	}

	VacancyListGetResponse struct {
		Vacancies []Vacancy
	}
)

// <=============================>
// 	  	   Create Vacancy
// <=============================>

type (
	VacancyCreateRequest struct {
		CompanyId          string
		Name               string
		Address            string
		WorkFormat         string
		AgentReward        *int32
		SalaryTop          int32
		SalaryBottom       int32
		Requirements       *string
		Responsibilities   *string
		ExtraInfo          *string
		Region             string
		TargetAction       VacancyTargetAction
		RequiredCandidates int32
		CurrentCandidates  int32
		ExtraFields        *string
	}

	VacancyCreateResponse struct {
		Id string
	}
)

// <=============================>
// 	  	   Update Vacancy
// <=============================>

type (
	VacancyUpdateRequest struct {
		Id                 string
		Name               *string
		Address            *string
		WorkFormat         *string
		AgentReward        *int32
		SalaryTop          *int32
		SalaryBottom       *int32
		Requirements       *string
		Responsibilities   *string
		ExtraInfo          *string
		Region             *string
		TargetAction       VacancyTargetActionForUpdate
		RequiredCandidates *int32
		ExtraFields        *string
	}

	VacancyTargetActionForUpdate struct {
		Action   *string
		Duration *int32
	}

	VacancyUpdateResponse struct {
	}
)

// <=============================>
// 	  	   Delete Vacancy
// <=============================>

type (
	VacancyDeleteRequest struct {
		Id string
	}

	VacancyDeleteResponse struct {
	}
)

// <=============================>
// 	 Send Vacancy to Moderation
// <=============================>

type (
	SendVacancyToModerationRequest struct {
		Id string
	}

	SendVacancyToModerationResponse struct {
	}
)
