"""
Represents a WebM of an anime theme.

For example, the video Bakemonogatari-OP1.webm represents the WebM of the Bakemonogatari OP1 theme.
"""
type Video @model(class: "App\\Models\\Wiki\\Video") {
    "The primary key of the resource"
    id: Int! @rename(attribute: "video_id")

    "The basename of the file in storage"
    basename: String!

    "The filename of the file in storage"
    filename: String!

    "Does the video include subtitles of song lyrics?"
    lyrics: Boolean!

    "The media type of the file in storage"
    mimetype: String!

    "Is the video creditless?"
    nc: Boolean!

    "The degree to which the sequence and episode content overlap"
    overlap: VideoOverlap!

    "The formatted string value of the overlap field"
    overlapLocalized: String! @localized

    "The path of the file in storage"
    path: String!

    "The priority value for the video"
    priority: Int!

    "The frame height of the file in storage"
    resolution: Int

    "The size of the file in storage in Bytes"
    size: Int!

    "Where did this video come from?"
    source: VideoSource

    "The formatted string value of the source field"
    sourceLocalized: String @localized

    "Does the video include subtitles of dialogue?"
    subbed: Boolean!

    "Is the video an uncensored version of a censored sequence?"
    uncen: Boolean!

    "The attributes used to distinguish the file within the context of a theme"
    tags: String

    "The URL to stream the file from storage"
    link: String!

    "The date that the resource was created"
    createdAt(format: String! = "Y-m-d H:i:s"): String @timestamp(attribute: "created_at")

    "The date that the resource was updated"
    updatedAt(format: String! = "Y-m-d H:i:s"): String @timestamp(attribute: "updated_at")

    audio: Audio! @belongsTo

    videoscript: VideoScript @belongsTo

    tracks(
        sort: [PlaylistTrackSort!] @sort
    ): [PlaylistTrack!]! @hasManyCustom(type: SIMPLE)

    animethemeentries(
        episodes: String @eq
        episodes_like: String @like(key: "episodes")
        nsfw: Boolean @eq
        spoiler: Boolean @eq
        version: Int @eq
        version_lesser: Int @where(operator: "<", key: "version")
        version_greater: Int @where(operator: ">", key: "version")
        where: _ @whereConditions(columnsEnum: AnimeThemeEntryFilterableColumns, handler: "App\\GraphQL\\WhereConditions\\WhereConditionsHandler")
        sort: [AnimeThemeEntrySort!] @sort
    ): [AnimeThemeEntry!]! @belongsToManyCustom(type: CONNECTION, edgeType: "VideoAnimeThemeEntryEdge")
}

type VideoAnimeThemeEntryEdge @model(class: "App\\Pivots\\Wiki\\AnimeThemeEntryVideo") {
    "The anime theme entry node."
    node: AnimeThemeEntry!

    "The date that the resource was created"
    createdAt(format: String! = "Y-m-d H:i:s"): String @timestamp(attribute: "created_at")

    "The date that the resource was updated"
    updatedAt(format: String! = "Y-m-d H:i:s"): String @timestamp(attribute: "updated_at")
}

extend type Query {
    "Returns a video resource."
    video(id: Int! @eq(key: "video_id")): Video @find(model: "App\\Models\\Wiki\\Video")

    "Returns a listing of video resources given fields."
    videoPagination(
        id: Int @eq(key: "video_id")
        basename: String @eq
        filename: String @eq
        lyrics: Boolean @eq
        mimetype: String @eq
        nc: Boolean @eq
        overlap: VideoOverlap @eq
        path: String @eq
        path_like: String @like(key: "path")
        resolution: Int @eq
        resolution_lesser: Int @where(operator: "<", key: "resolution")
        resolution_greater: Int @where(operator: ">", key: "resolution")
        size_lesser: Int @where(operator: "<", key: "size")
        size_greater: Int @where(operator: ">", key: "size")
        source: VideoSource @eq
        subbed: Boolean @eq
        uncen: Boolean @eq
        where: _ @whereConditions(columnsEnum: VideoFilterableColumns, handler: "App\\GraphQL\\WhereConditions\\WhereConditionsHandler")
        sort: [VideoSort!] @sort
    ): [Video!]! @paginate
}