/*
 * THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT.
 */

import { l } from '@atproto/lex'

const $nsid = 'fm.teal.alpha.feed.defs'

export { $nsid }

type PlayView = {
  $type?: 'fm.teal.alpha.feed.defs#playView'

  /**
   * The name of the track
   */
  trackName: string

  /**
   * The MusicBrainz ID URI of the track, formatted as mbid:<uuid>
   */
  trackMbId?: l.UriString

  /**
   * The MusicBrainz recording ID URI of the track, formatted as mbid:<uuid>
   */
  recordingMbId?: l.UriString

  /**
   * The length of the track in seconds
   */
  duration?: number

  /**
   * Array of artists in order of original appearance.
   */
  artists: Artist[]

  /**
   * The name of the release/album
   */
  releaseName?: string

  /**
   * The MusicBrainz release ID URI, formatted as mbid:<uuid>
   */
  releaseMbId?: l.UriString

  /**
   * The ISRC code associated with the recording
   */
  isrc?: string

  /**
   * The URL associated with this track
   */
  originUrl?: string

  /**
   * The base domain of the music service. e.g. music.apple.com, tidal.com, spotify.com. Defaults to 'local' if not provided.
   */
  musicServiceBaseDomain?: string

  /**
   * A user-agent style string specifying the user agent. e.g. tealtracker/0.0.1b (Linux; Android 13; SM-A715F). Defaults to 'manual/unknown' if not provided.
   */
  submissionClientAgent?: string

  /**
   * The unix timestamp of when the track was played
   */
  playedTime?: l.DatetimeString
}

export type { PlayView }

const playView = /*#__PURE__*/ l.typedObject<PlayView>(
  $nsid,
  'playView',
  /*#__PURE__*/ l.object({
    trackName: /*#__PURE__*/ l.string({
      minLength: 1,
      maxLength: 256,
      maxGraphemes: 2560,
    }),
    trackMbId: /*#__PURE__*/ l.optional(
      /*#__PURE__*/ l.string({ format: 'uri' }),
    ),
    recordingMbId: /*#__PURE__*/ l.optional(
      /*#__PURE__*/ l.string({ format: 'uri' }),
    ),
    duration: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.integer()),
    artists: /*#__PURE__*/ l.array(
      /*#__PURE__*/ l.ref<Artist>((() => artist) as any),
    ),
    releaseName: /*#__PURE__*/ l.optional(
      /*#__PURE__*/ l.string({ maxLength: 256, maxGraphemes: 2560 }),
    ),
    releaseMbId: /*#__PURE__*/ l.optional(
      /*#__PURE__*/ l.string({ format: 'uri' }),
    ),
    isrc: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),
    originUrl: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),
    musicServiceBaseDomain: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),
    submissionClientAgent: /*#__PURE__*/ l.optional(
      /*#__PURE__*/ l.string({ maxLength: 256, maxGraphemes: 2560 }),
    ),
    playedTime: /*#__PURE__*/ l.optional(
      /*#__PURE__*/ l.string({ format: 'datetime' }),
    ),
  }),
)

export { playView }

type Artist = {
  $type?: 'fm.teal.alpha.feed.defs#artist'

  /**
   * The name of the artist
   */
  artistName: string

  /**
   * The MusicBrainz artist ID URI, formatted as mbid:<uuid>
   */
  artistMbId?: l.UriString
}

export type { Artist }

const artist = /*#__PURE__*/ l.typedObject<Artist>(
  $nsid,
  'artist',
  /*#__PURE__*/ l.object({
    artistName: /*#__PURE__*/ l.string({
      minLength: 1,
      maxLength: 256,
      maxGraphemes: 2560,
    }),
    artistMbId: /*#__PURE__*/ l.optional(
      /*#__PURE__*/ l.string({ format: 'uri' }),
    ),
  }),
)

export { artist }
