"""
Represents a musical performer of anime sequences.

For example, Chiwa Saitou is the musical performer of the Bakemonogatari OP1 theme, among many others.
"""
type Artist @model(class: "App\\Models\\Wiki\\Artist") {
    "The primary key of the resource"
    id: Int! @rename(attribute: "artist_id")

    "The primary title of the artist"
    name: String!

    "The URL slug & route key of the resource"
    slug: String!

    "The brief information of the resource"
    information: String

    "The URL for the artist page on the website"
    siteUrl: String! @field(resolver: "App\\GraphQL\\Types\\ArtistType@resolveSiteUrlAttribute")

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

    synonyms(
        type: SynonymType @eq
        where: _ @whereConditions(columnsEnum: SynonymFilterableColumns, handler: "App\\GraphQL\\WhereConditions\\WhereConditionsHandler")
        sort: [SynonymSort!] @sort
    ): [Synonym!]! @morphMany

    images(
        facet: ImageFacet @eq
        path_like: String @like(key: "path")
        where: _ @whereConditions(columnsEnum: ImageFilterableColumns, handler: "App\\GraphQL\\WhereConditions\\WhereConditionsHandler")
        sort: [ImageSort!] @sort
    ): [Image!]! @belongsToManyCustom(type: CONNECTION, edgeType: "ImageEdge")

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

    performances(
        alias: String @eq
        as: String @eq
        memberAlias: String @eq(key: "member_alias")
        memberAs: String @eq(key: "member_as")
        relevance: Int @eq
        relevance_lesser: Int @where(operator: "<", key: "relevance")
        relevance_greater: Int @where(operator: ">", key: "relevance")
        where: _ @whereConditions(columnsEnum: PerformanceFilterableColumns, handler: "App\\GraphQL\\WhereConditions\\WhereConditionsHandler")
        sort: [PerformanceSort!] @sort
    ): [Performance!]! @hasManyCustom(type: SIMPLE)

    memberPerformances(
        alias: String @eq
        as: String @eq
        memberAlias: String @eq(key: "member_alias")
        memberAs: String @eq(key: "member_as")
        relevance: Int @eq
        relevance_lesser: Int @where(operator: "<", key: "relevance")
        relevance_greater: Int @where(operator: ">", key: "relevance")
        where: _ @whereConditions(columnsEnum: PerformanceFilterableColumns, handler: "App\\GraphQL\\WhereConditions\\WhereConditionsHandler")
        sort: [PerformanceSort!] @sort
    ): [Performance!]! @hasManyCustom(type: SIMPLE)

    members(
        name: String @eq
        name_like: String @like(key: "name")
        where: _ @whereConditions(columnsEnum: ArtistFilterableColumns, handler: "App\\GraphQL\\WhereConditions\\WhereConditionsHandler")
        sort: [ArtistMemberSort!] @sort
    ): [Artist!]! @belongsToManyCustom(type: CONNECTION, edgeType: "ArtistMemberEdge")

    groups(
        name: String @eq
        name_like: String @like(key: "name")
        where: _ @whereConditions(columnsEnum: ArtistFilterableColumns, handler: "App\\GraphQL\\WhereConditions\\WhereConditionsHandler")
        sort: [ArtistMemberSort!] @sort
    ): [Artist!]! @belongsToManyCustom(type: CONNECTION, edgeType: "ArtistMemberEdge")
}

type ArtistMemberEdge @model(class: "App\\Pivots\\Wiki\\ArtistMember") {
    "The Artist node."
    node: Artist!

    "Used to distinguish member by alias"
    alias: String

    "Used to distinguish member by character"
    as: String

    "Used to extra annotation, like member role"
    notes: String

    "Used to determine the relevance order of members in group"
    relevance: 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 an artist resource."
    artist(slug: String! @eq): Artist @find(model: "App\\Models\\Wiki\\Artist")

    "Returns a listing of artist resources given fields."
    artistPagination(
        id: Int @eq(key: "artist_id")
        name: String @eq
        name_like: String @like(key: "name")
        search: String @search
        slug: String @eq
        where: _ @whereConditions(columnsEnum: ArtistFilterableColumns, handler: "App\\GraphQL\\WhereConditions\\WhereConditionsHandler")
        sort: [ArtistSort!] @sort
    ): [Artist!]! @paginate
}