type UserSpaceResult {
    totalCount: Int
    count: Int
    nodes: [UserSpace]
}

type UserSpaceHistory implements DbHistoryModel {
    id: Int
    name: String
    owner: User

    users: [User]

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

type UserSpace implements DbModel {
    id: Int
    name: String
    owner: User

    users: [User]

    deleted: Boolean
    editor: User
    created: String
    updated: String
    history: [UserSpaceHistory]
}

input UserSpaceSort {
    id: SortOrder
    name: SortOrder
    owner: SortOrder

    deleted: SortOrder
    editorId: SortOrder
    created: SortOrder
    updated: SortOrder
}

enum UserSpaceFuzzyFields {
    name
    owner
}

input UserSpaceFuzzy {
    fields: [UserSpaceFuzzyFields]
    term: String
    threshold: Int
}

input UserSpaceFilter {
    id: IntFilter
    name: StringFilter
    owner: UserFilter

    fuzzy: UserSpaceFuzzy

    deleted: BooleanFilter
    editor: IntFilter
    created: DateFilter
    updated: DateFilter

    isNull: Boolean
    isNotNull: Boolean
}

type UserSpaceMutation {
    create(input: UserSpaceCreateInput!): UserSpace
    update(input: UserSpaceUpdateInput!): UserSpace
    delete(id: Int!): Boolean
    restore(id: Int!): Boolean

    inviteUsers(id: Int!, emails: [String!]!): Boolean
}

input UserSpaceCreateInput {
    name: String!
    users: [Int]
}

input UserSpaceUpdateInput {
    id: Int!
    name: String
    users: [Int]
}