package dto

//////////////////////////////////////////////////////////////
// Horoscope (zodiac 1 = Aries .. 12 = Pisces)
//////////////////////////////////////////////////////////////

type DailyHoroscopeRequest struct {
	ClientInfo

	Zodiac int    `json:"zodiac" binding:"required,min=1,max=12"`
	Date   string `json:"date"`
	Type   string `json:"type"`
	Split  bool   `json:"split"`
	Lang   string `json:"lang"`
}

type WeeklyHoroscopeRequest struct {
	ClientInfo

	Zodiac   int    `json:"zodiac" binding:"required,min=1,max=12"`
	Week     string `json:"week"`
	ShowSame bool   `json:"show_same"`
	Lang     string `json:"lang"`
}

type YearlyHoroscopeRequest struct {
	ClientInfo

	Zodiac int    `json:"zodiac" binding:"required,min=1,max=12"`
	Year   int    `json:"year"`
	Lang   string `json:"lang"`
}

type DailyNakshatraRequest struct {
	ClientInfo

	Nakshatra int    `json:"nakshatra" binding:"required,min=1,max=27"`
	Date      string `json:"date"`
	Lang      string `json:"lang"`
}

//////////////////////////////////////////////////////////////
// Caller
//////////////////////////////////////////////////////////////

// HoroscopeCaller is who asked and from where, built by the controller from
// the token and the X-Platform / X-Device-Type / X-App-Version headers. It
// decides whether the read is charged and is what the horoscope_requests log
// row is written from.
type HoroscopeCaller struct {
	// UserID is users.id from the token, on both stacks. It is the wallet
	// that is charged when Chargeable is set.
	UserID uint

	// AstrologerID is astrologers.id, set only on the astrologer side.
	AstrologerID *uint

	ActorType  string // customer | astrologer
	Platform   string // customer_app | astrologer_app | web | astrologer_web
	DeviceType string // android | ios | web, or empty
	AppVersion string
	IPAddress  string

	// Chargeable is false for astrologers, who are never charged.
	Chargeable bool

	// CataloguePrice is what the admin catalogue charges for this call, set by
	// the usage middleware (which does the debit after a success). When it is
	// set the service does not charge itself, only logs the amount.
	CataloguePrice *float64
}

//////////////////////////////////////////////////////////////
// Feedback
//////////////////////////////////////////////////////////////

type HoroscopeFeedbackRequest struct {
	ClientInfo

	FeedbackType  string `json:"feedbacktype" binding:"required,oneof=Great Average Poor"`
	Feedback      string `json:"feedback" binding:"max=1000"`
	HoroscopeType string `json:"horoscope_type" binding:"omitempty,oneof=daily daily_moon daily_nakshatra weekly yearly"`
	Zodiac        int    `json:"zodiac" binding:"omitempty,min=1,max=12"`
}

//////////////////////////////////////////////////////////////
// Signs
//////////////////////////////////////////////////////////////

// HoroscopeSign is one hororscope_signs row with the VedicAstroAPI number the
// prediction endpoints take. Zodiac is 1..12 by name; SignID is the table id,
// which skips 2 and must never be sent as `zodiac`.
type HoroscopeSign struct {
	Zodiac int    `json:"zodiac"`
	SignID uint   `json:"sign_id"`
	Name   string `json:"name"`

	// Image is the full URL on the admin panel, which hosts the uploads;
	// ImagePath is the stored relative path.
	Image     string `json:"image"`
	ImagePath string `json:"image_path"`

	// SvgImage is the sign as inline SVG markup (<svg>...</svg>), sanitised by
	// the admin panel on save; null when the admin has not added one.
	SvgImage *string `json:"svg_image"`
}

//////////////////////////////////////////////////////////////
// Client Info
//////////////////////////////////////////////////////////////

// ClientInfo is the optional body alternative to the X-Platform,
// X-Device-Type and X-App-Version headers. Headers win when both are sent.
type ClientInfo struct {
	Platform   string `json:"platform"`
	DeviceType string `json:"device_type"`
	AppVersion string `json:"app_version"`
}
