package catalog

type MediaType string

const (
	MediaTypeMovie MediaType = "movie"
	MediaTypeShow  MediaType = "show"
	MediaTypeGame  MediaType = "game"
)

type MediaProvider string

const (
	MediaProviderTMDB MediaProvider = "tmdb"
	MediaProviderIGDB MediaProvider = "igdb"
)

type MediaItem struct {
	ID             int           `json:"id"`
	Provider       MediaProvider `json:"provider"`
	ProviderID     int           `json:"providerId"`
	Title          string        `json:"title"`
	Overview       string        `json:"overview"`
	Type           MediaType     `json:"type"`
	ReleaseDate    string        `json:"releaseDate"`
	Genres         []string      `json:"genres"`
	Platforms      []string      `json:"platforms"`
	Rating         float64       `json:"rating"`
	RuntimeMinutes int           `json:"runtimeMinutes"`
	ArtworkKey     string        `json:"artworkKey"`
}

type EpisodeProgress struct {
	ItemID          int    `json:"itemId"`
	SeasonNumber    int    `json:"seasonNumber"`
	EpisodeNumber   int    `json:"episodeNumber"`
	ProgressPercent int    `json:"progressPercent"`
	LastWatchedAt   string `json:"lastWatchedAt"`
}

type ContinueWatchingItem struct {
	Item     MediaItem       `json:"item"`
	Progress EpisodeProgress `json:"progress"`
}

type DownloadJob struct {
	ID                string  `json:"id"`
	Title             string  `json:"title"`
	Status            string  `json:"status"`
	ProgressPercent   int     `json:"progressPercent"`
	DownloadSpeedMbps float64 `json:"downloadSpeedMbps"`
	EtaMinutes        int     `json:"etaMinutes"`
	SourceType        string  `json:"sourceType"`
}

type RecommendationItem struct {
	ID     int       `json:"id"`
	Reason string    `json:"reason"`
	Score  int       `json:"score"`
	Media  MediaItem `json:"media"`
}

type DashboardPayload struct {
	WatchLater      []MediaItem          `json:"watchLater"`
	GameBacklog     []MediaItem          `json:"gameBacklog"`
	ActiveDownloads []DownloadJob        `json:"activeDownloads"`
	Recommendations []RecommendationItem `json:"recommendations"`
	Trending        []MediaItem          `json:"trending"`
	Upcoming        []MediaItem          `json:"upcoming"`
	RecentlyWatched []MediaItem          `json:"recentlyWatched"`
}

type DiscoverSection struct {
	Kind     string      `json:"kind"`
	Title    string      `json:"title"`
	Subtitle string      `json:"subtitle"`
	Items    []MediaItem `json:"items"`
}

type SearchResult struct {
	ID        int      `json:"id"`
	MediaType string   `json:"mediaType"`
	Title     string   `json:"title"`
	Subtitle  string   `json:"subtitle"`
	Genres    []string `json:"genres"`
	Score     int      `json:"score"`
}

type DiscoverParams struct {
	Page      int
	PageSize  int
	Query     string
	Genre     string
	MediaType string
}

type SearchParams struct {
	Query     string
	Genre     string
	MediaType string
}

type ProgressUpdateInput struct {
	MediaID         int
	SeasonNumber    int
	EpisodeNumber   int
	ProgressPercent int
}
