type ShortUrlResult {
    totalCount: Int
    count: Int
    nodes: [ShortUrl]
}

type ShortUrlHistory implements DbHistoryModel {
    id: Int
    shortUrl: String
    targetUrl: String
    description: String
    visits: Int
    loadingScreen: Boolean

    group: Group
    domain: Domain
    userSpace: UserSpace

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

type ShortUrl implements DbModel {
    id: Int
    shortUrl: String
    targetUrl: String
    description: String
    visits: Int
    loadingScreen: Boolean

    group: Group
    domain: Domain
    userSpace: UserSpace

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

input ShortUrlSort {
    id: SortOrder
    name: SortOrder
    description: SortOrder
    loadingScreen: SortOrder

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

enum ShortUrlFuzzyFields {
    shortUrl
    targetUrl
    description
}

input ShortUrlFuzzy {
    fields: [ShortUrlFuzzyFields]
    term: String
    threshold: Int
}

input ShortUrlFilter {
    id: IntFilter
    shortUrl: StringFilter
    targetUrl: StringFilter
    description: StringFilter
    loadingScreen: BooleanFilter

    group: GroupFilter
    domain: DomainFilter

    userSpace: UserSpaceFilter

    fuzzy: ShortUrlFuzzy

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

type ShortUrlMutation {
    create(input: ShortUrlCreateInput!): ShortUrl
    update(input: ShortUrlUpdateInput!): ShortUrl
    delete(id: Int!): Boolean
    restore(id: Int!): Boolean
    trackVisit(id: Int!, agent: String): Boolean
}

input ShortUrlCreateInput {
    userSpaceId: Int!
    shortUrl: String!
    targetUrl: String!
    description: String
    groupId: Int
    domainId: Int
    loadingScreen: Boolean
}

input ShortUrlUpdateInput {
    id: Int!
    shortUrl: String
    targetUrl: String
    description: String
    groupId: Int
    domainId: Int
    loadingScreen: Boolean
}
