package tpdb

import "encoding/json"

// APIResponse is the standard TPDB API response wrapper
type APIResponse struct {
	Data json.RawMessage `json:"data"`
	Meta *MetaData       `json:"meta,omitempty"`
}

// MetaData contains pagination information
type MetaData struct {
	CurrentPage int `json:"current_page"`
	From        int `json:"from"`
	LastPage    int `json:"last_page"`
	PerPage     int `json:"per_page"`
	To          int `json:"to"`
	Total       int `json:"total"`
}

// PerformerExtras contains detailed performer information from TPDB
type PerformerExtras struct {
	Gender          string  `json:"gender"`
	Birthday        *string `json:"birthday"`
	Deathday        *string `json:"deathday"`
	Birthplace      *string `json:"birthplace"`
	Astrology       *string `json:"astrology"`
	Ethnicity       *string `json:"ethnicity"`
	Nationality     *string `json:"nationality"`
	HairColour      *string `json:"hair_colour"`
	EyeColour       *string `json:"eye_colour"`
	Weight          *string `json:"weight"`           // e.g., "49kg"
	Height          *string `json:"height"`           // e.g., "160cm"
	Measurements    *string `json:"measurements"`
	Cupsize         *string `json:"cupsize"`
	Tattoos         *string `json:"tattoos"`
	Piercings       *string `json:"piercings"`
	FakeBoobs       *bool   `json:"fake_boobs"`
	CareerStartYear *int    `json:"career_start_year"`
	CareerEndYear   *int    `json:"career_end_year"`
}

// PerformerResponse represents a TPDB performer
type PerformerResponse struct {
	ID        string           `json:"id"`     // UUID
	NumericID int              `json:"_id"`    // Numeric ID
	Name      string           `json:"name"`
	Slug      string           `json:"slug"`
	Aliases   []string         `json:"aliases"`
	Bio       *string          `json:"bio"`
	Image     *string          `json:"image"`
	Poster    *string          `json:"poster"`
	Extras    *PerformerExtras `json:"extras"` // Detailed info
}

// StudioResponse represents a TPDB studio/site
type StudioResponse struct {
	ID          int     `json:"id"`
	Name        string  `json:"name"`
	Slug        string  `json:"slug"`
	URL         *string `json:"url"`
	Description *string `json:"description"`
	Logo        *string `json:"logo"`
	Parent      *ParentStudio `json:"parent"`
}

// ParentStudio represents a parent studio/network
type ParentStudio struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
	Slug string `json:"slug"`
}

// SceneResponse represents a TPDB scene
type SceneResponse struct {
	ID          string               `json:"id"`
	UUID        string               `json:"uuid"`
	Title       string               `json:"title"`
	Description *string              `json:"description"`
	URL         *string              `json:"url"`
	Date        *string              `json:"date"`
	Image       *string              `json:"image"`
	Poster      *string              `json:"poster"`
	Duration    *int                 `json:"duration"`
	Director    *string              `json:"director"`
	Code        *string              `json:"code"`
	Site        *SiteInfo            `json:"site"`
	Performers  []PerformerInfo      `json:"performers"`
	Tags        []TagInfo            `json:"tags"`
}

// SiteInfo represents basic site information in a scene response
type SiteInfo struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
	URL  *string `json:"url"`
}

// PerformerInfo represents basic performer information in a scene response
type PerformerInfo struct {
	ID     string  `json:"id"`
	Name   string  `json:"name"`
	Gender *string `json:"gender"`
}

// TagInfo represents tag information in a scene response
type TagInfo struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Slug string `json:"slug"`
}
