type RoleResult {
    totalCount: Int
    count: Int
    nodes: [Role]
}

type RoleHistory implements DbHistoryModel {
    id: Int
    name: String
    description: String

    permissions: [Permission]

    deleted: Boolean
    editor: String
    created: String
    updated: String
}

type Role implements DbModel {
    id: Int
    name: String
    description: String
    permissions: [Permission]
    users: [User]

    deleted: Boolean
    editor: User
    created: String
    updated: String

    history: [RoleHistory]
}

input RoleSort {
    id: SortOrder
    name: SortOrder
    description: SortOrder

    deleted: SortOrder
    editor: UserSort
    created: SortOrder
    updated: SortOrder
}

enum RoleFuzzyFields {
    id
    name
    description

    deleted
    editor
    created
    updated
}

input RoleFuzzy {
    fields: [RoleFuzzyFields]
    term: String
    threshold: Int
}

input RoleFilter {
    id: IntFilter
    name: StringFilter
    description: StringFilter

    fuzzy: RoleFuzzy

    deleted: BooleanFilter
    editor_id: IntFilter
    created: DateFilter
    updated: DateFilter
}

type RoleMutation {
    create(input: RoleCreateInput!): Role
    update(input: RoleUpdateInput!): Role
    delete(id: Int!): Boolean
    restore(id: Int!): Boolean
}

input RoleCreateInput {
    name: String!
    description: String
    permissions: [Int]
}

input RoleUpdateInput {
    id: Int!
    name: String
    description: String
    permissions: [Int]
}