"""
Represents the audio track of a video.

For example, the audio Bakemonogatari-OP1.ogg represents the audio track of the Bakemonogatari-OP1.webm video.
"""
type Audio @model(class: "App\\Models\\Wiki\\Audio") {
    "The primary key of the resource"
    id: Int! @rename(attribute: "audio_id")

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

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

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

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

    "The path of the file in storage"
    path: 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")

    videos: [Video!]! @hasManyCustom(type: SIMPLE)
}

extend type Query {
    "Returns a listing of audio resources given fields."
    audioPagination(
        id: Int @eq(key: "audio_id")
        basename: String @eq
        filename: String @eq
        mimetype: String @eq
        path: String @eq
        path_like: String @like(key: "path")
        size_lesser: Int @where(operator: "<", key: "size")
        size_greater: Int @where(operator: ">", key: "size")
        where: _ @whereConditions(columnsEnum: AudioFilterableColumns, handler: "App\\GraphQL\\WhereConditions\\WhereConditionsHandler")
        sort: [AudioSort!] @sort
    ): [Audio!]! @paginate
}