package dto

import (
	"encoding/json"
	"time"
)

//////////////////////////////////////////////////////////////
// Kundali Matching
//////////////////////////////////////////////////////////////

type MatchingRequest struct {
	Boy       PersonInput `json:"boy" binding:"required"`
	Girl      PersonInput `json:"girl" binding:"required"`
	MatchType string      `json:"match_type"`
	Lang      string      `json:"lang"`
}

// NakshatraMatchRequest is the cheap star-only match used by the quick-match
// widget, which has no birth times to work with.
type NakshatraMatchRequest struct {
	BoyStar  int    `json:"boy_star" binding:"required,min=1,max=27"`
	GirlStar int    `json:"girl_star" binding:"required,min=1,max=27"`
	Lang     string `json:"lang"`
}

type WesternMatchRequest struct {
	BoySign  int    `json:"boy_sign" binding:"required,min=1,max=12"`
	GirlSign int    `json:"girl_sign" binding:"required,min=1,max=12"`
	Lang     string `json:"lang"`
}

type MatchingPDFRequest struct {
	MatchingRequest
	Style string `json:"style"`
	Color string `json:"color"`
}

type ListMatchingRequest struct {
	PaginationRequest
}

type MatchingResponse struct {
	ID             uint            `json:"id"`
	BoyName        string          `json:"boy_name"`
	BoyBirthDate   string          `json:"boy_birth_date"`
	BoyBirthTime   string          `json:"boy_birth_time"`
	BoyBirthPlace  string          `json:"boy_birth_place"`
	GirlName       string          `json:"girl_name"`
	GirlBirthDate  string          `json:"girl_birth_date"`
	GirlBirthTime  string          `json:"girl_birth_time"`
	GirlBirthPlace string          `json:"girl_birth_place"`
	MatchType      string          `json:"match_type"`
	Lang           string          `json:"lang"`
	AshtakootScore *string         `json:"ashtakoot_score"`
	DashakootScore *string         `json:"dashakoot_score"`
	Conclusion     *string         `json:"conclusion"`
	PDFLink        *string         `json:"pdf_link"`
	Result         json.RawMessage `json:"result,omitempty"`
	CreatedAt      *time.Time      `json:"created_at"`
}

type ListMatchingResponse struct {
	Total    int64              `json:"total"`
	Page     int                `json:"page"`
	Limit    int                `json:"limit"`
	Matching []MatchingResponse `json:"matching"`
}

type SaveMatchingResponse struct {
	Charged  float64          `json:"charged"`
	Matching MatchingResponse `json:"matching"`
}
