/* OUTPUT */

export interface Output<S = TrackStats, T = TrackTags> {
  tracks: Track<S, T>[];
}

export interface ManagedOutput<S = TrackStats, T = TrackTags> {
  tracks: {
    cacheId: string;
    state: "loading" | "loaded";
    collection: Track<S, T>[];
  };
}

/* TRACKS */

export type ResolvedUri = undefined | { url: string; expiresAt: number }; // TODO: Streams?

export interface Track<Stats = TrackStats, Tags = TrackTags> {
  id: string;

  kind?: "music" | "audiobook" | "podcast" | "miscellaneous";
  stats?: Stats;
  tags?: Tags;

  // NOTE: This is a "semi-permanent" URI.
  //
  // Tracks are cached so you can't, for example,
  // use an URL that expires in several hours.
  uri: string;
}

export interface TrackStats {
  duration?: number;
}

export interface TrackTags {
  album?: string;
  artist?: string;
  disc: { no: number; of?: number };
  genre?: string;
  title: string;
  track: { no: number; of?: number };
  year?: number;
}
