"""
Represents a version of an anime theme.

For example, the ED theme of the Bakemonogatari anime has three anime theme entries to represent three versions.
"""
type AnimeThemeEntry @model(class: "App\\Models\\Wiki\\Anime\\Theme\\AnimeThemeEntry") {
    "The primary key of the resource"
    id: Int! @rename(attribute: "entry_id")

    "The episodes that the theme is used for"
    episodes: String

    "Any additional information for this sequence"
    notes: String

    "Is not safe for work content included?"
    nsfw: Boolean!

    "Is content included that may spoil the viewer?"
    spoiler: Boolean!

    "The version number of the theme"
    version: Int!

    "The number of likes recorded for the resource"
    likesCount: Int! @aggregateCustom(column: "value", function: SUM, relation: "likeAggregate")

    "The number of tracks belonging to the resource"
    tracksCount: Int! @count(relation: "tracks")

    "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")

    animetheme: AnimeTheme! @belongsTo

    resources(
        site: ResourceSite @eq
        externalId: Int @eq(key: "external_id")
        where: _ @whereConditions(columnsEnum: ExternalResourceFilterableColumns, handler: "App\\GraphQL\\WhereConditions\\WhereConditionsHandler")
        sort: [ExternalResourceSort!] @sort
    ): [ExternalResource!]! @belongsToManyCustom(type: CONNECTION, edgeType: "ExternalResourceEdge")

    videos(
        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!]! @belongsToManyCustom(type: CONNECTION, edgeType: "AnimeThemeEntryVideoEdge")
}

type AnimeThemeEntryVideoEdge @model(class: "App\\Pivots\\Wiki\\AnimeThemeEntryVideo") {
    "The Video node."
    node: Video!

    "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 {
    animethemeentryPagination(
        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!]! @paginate
}