"""
Represents a visual component for another resource such as an anime or artist.

For example, the Bakemonogatari anime has two images to represent small and large cover images.
"""
type Image @model(class: "App\\Models\\Wiki\\Image") {
    "The primary key of the resource"
    id: Int! @rename(attribute: "image_id")

    "The component that the resource is intended for"
    facet: ImageFacet!

    "The formatted string value of the facet field"
    facetLocalized: String! @localized

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

type ImageEdge @model(class: "App\\Pivots\\Morph\\Imageable") {
    "The Image node."
    node: Image!

    "Used to sort the images"
    depth: Int!

    "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 listing of images resources given fields."
    imagePagination(
        id: Int @eq(key: "image_id")
        facet: ImageFacet @eq
        path: String @eq
        path_like: String @like(key: "path")
        where: _ @whereConditions(columnsEnum: ImageFilterableColumns, handler: "App\\GraphQL\\WhereConditions\\WhereConditionsHandler")
        sort: [ImageSort!] @sort
    ): [Image!]! @paginate
}