/*
Copyright © 2023 Philipp Wolfer <phw@uploadedlobster.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

package spotify

type TracksResult struct {
	Href     string       `json:"href"`
	Limit    int          `json:"limit"`
	Next     string       `json:"next"`
	Previous string       `json:"previous"`
	Offset   int          `json:"offset"`
	Total    int          `json:"total"`
	Items    []SavedTrack `json:"items"`
}

type SavedTrack struct {
	AddedAt string `json:"added_at"`
	Track   Track  `json:"track"`
}

type RecentlyPlayedResult struct {
	Href    string   `json:"href"`
	Limit   int      `json:"limit"`
	Next    string   `json:"next"`
	Cursors Cursors  `json:"cursors"`
	Items   []Listen `json:"items"`
}

type Cursors struct {
	After  string `json:"after"`
	Before string `json:"before"`
}

type Listen struct {
	PlayedAt string `json:"played_at"`
	Track    Track  `json:"track"`
}

type Track struct {
	Id           string       `json:"id"`
	Name         string       `json:"name"`
	Href         string       `json:"href"`
	Uri          string       `json:"uri"`
	Type         string       `json:"type"`
	DiscNumber   int          `json:"disc_number"`
	TrackNumber  int          `json:"track_number"`
	DurationMs   int          `json:"duration_ms"`
	Explicit     bool         `json:"explicit"`
	IsLocal      bool         `json:"is_local"`
	Popularity   int          `json:"popularity"`
	ExternalIds  ExternalIds  `json:"external_ids"`
	ExternalUrls ExternalUrls `json:"external_urls"`
	Album        Album        `json:"album"`
	Artists      []Artist     `json:"artists"`
}

type Album struct {
	Id                   string       `json:"id"`
	Name                 string       `json:"name"`
	Href                 string       `json:"href"`
	Uri                  string       `json:"uri"`
	Type                 string       `json:"type"`
	TotalTracks          int          `json:"total_tracks"`
	ReleaseDate          string       `json:"release_date"`
	ReleaseDatePrecision string       `json:"release_date_precision"`
	AlbumType            string       `json:"album_type"`
	ExternalUrls         ExternalUrls `json:"external_urls"`
	Artists              []Artist     `json:"artists"`
	Images               []Image      `json:"images"`
}

type Artist struct {
	Id           string       `json:"id"`
	Name         string       `json:"name"`
	Href         string       `json:"href"`
	Uri          string       `json:"uri"`
	Type         string       `json:"type"`
	ExternalUrls ExternalUrls `json:"external_urls"`
}

type ExternalIds struct {
	ISRC string `json:"isrc"`
	EAN  string `json:"ean"`
	UPC  string `json:"upc"`
}

type ExternalUrls struct {
	Spotify string `json:"spotify"`
}

type Image struct {
	Url    string `json:"url"`
	Height int    `json:"height"`
	Width  int    `json:"width"`
}