input ConnectUserInfoInput {
    preferred_username: String!
    email: String!
    avatar: String
}

input ConnectSignInInput {
    apiKey: String!
    idToken: String
    userInfo: ConnectUserInfoInput
    accessToken: String
    refreshToken: String
}

input AllowedOriginInput {
    origins: [String!]!
}

enum WAN_ACCESS_TYPE {
    DYNAMIC
    ALWAYS
    DISABLED
}

enum WAN_FORWARD_TYPE {
    UPNP
    STATIC
}

type RemoteAccess {
    accessType: WAN_ACCESS_TYPE!
    forwardType: WAN_FORWARD_TYPE
    port: Port
}

input SetupRemoteAccessInput {
    accessType: WAN_ACCESS_TYPE!
    forwardType: WAN_FORWARD_TYPE
    port: Port
}



input EnableDynamicRemoteAccessInput {
    url: AccessUrlInput!
    enabled: Boolean!
}

enum DynamicRemoteAccessType {
    STATIC
    UPNP
    DISABLED
}

type DynamicRemoteAccessStatus {
    enabledType: DynamicRemoteAccessType!
    runningType: DynamicRemoteAccessType!
    error: String
}

"""
    Intersection type of ApiSettings and RemoteAccess
"""
type ConnectSettingsValues {
    """
        If true, the GraphQL sandbox is enabled and available at /graphql.
        If false, the GraphQL sandbox is disabled and only the production API will be available.
    """
    sandbox: Boolean!
    """
        A list of origins allowed to interact with the API.
    """
    extraOrigins: [String!]!
    """
        The type of WAN access used for Remote Access.
    """
    accessType: WAN_ACCESS_TYPE!
    """
        The type of port forwarding used for Remote Access.
    """
    forwardType: WAN_FORWARD_TYPE
    """
        The port used for Remote Access.
    """
    port: Port
}

"""
    Input should be a subset of ApiSettings that can be updated.
    Some field combinations may be required or disallowed. Please refer to each field for more information.
"""
input ApiSettingsInput {
    """
        If true, the GraphQL sandbox will be enabled and available at /graphql.
        If false, the GraphQL sandbox will be disabled and only the production API will be available.
    """
    sandbox: Boolean
    """
        A list of origins allowed to interact with the API.
    """
    extraOrigins: [String!]
    """
        The type of WAN access to use for Remote Access.
    """
    accessType: WAN_ACCESS_TYPE
    """
        The type of port forwarding to use for Remote Access.
    """
    forwardType: WAN_FORWARD_TYPE
    """
        The port to use for Remote Access. Not required for UPNP forwardType. Required for STATIC forwardType.
        Ignored if accessType is DISABLED or forwardType is UPNP.
    """
    port: Port
}

type ConnectSettings implements Node {
    id: ID!
    dataSchema: JSON!
    uiSchema: JSON!
    values: ConnectSettingsValues!
}

type Connect implements Node {
    id: ID!
    dynamicRemoteAccess: DynamicRemoteAccessStatus!
    settings: ConnectSettings!
}

type Query {
    remoteAccess: RemoteAccess!
    extraAllowedOrigins: [String!]!
    connect: Connect!
}

type Mutation {
    connectSignIn(input: ConnectSignInInput!): Boolean!
    connectSignOut: Boolean!
    enableDynamicRemoteAccess(input: EnableDynamicRemoteAccessInput!): Boolean!
    setAdditionalAllowedOrigins(input: AllowedOriginInput!): [String!]!
    setupRemoteAccess(input: SetupRemoteAccessInput!): Boolean!
    """
        Update the API settings.
        Some setting combinations may be required or disallowed. Please refer to each setting for more information.
    """
    updateApiSettings(input: ApiSettingsInput!): ConnectSettingsValues!
}           