"""
Territorial State
"""
interface ITerritorialState {
    id: ID!
    name: String!
    country: ICountry!
    location: GeoLocation
    createdAt: DateTime!
    updatedAt: DateTime!
}

"""
Address State Create Input
"""
input TerritorialStateInput {
    """
    Name of the country to display
    """
    name: String!
    """
    ID of Country to associate
    """
    country: String!
}

"""
Address State Update Input
"""
input TerritorialStateUpdateInput {
    name: String
    country: Int!
}


"""
Address State
"""
type State implements ITerritorialState @entity {
    id: ID! @id
    name: String! @column
    country: Country! @column(overrideType: "ObjectId")
    cities(criteria: AnyObject, limit: Int, skip: Int, sort: Sort): Cities!
    location: GeoLocation @column(overrideType: "IGeoLocation")
    createdAt: DateTime! @column(overrideType: "Date")
    updatedAt: DateTime! @column(overrideType: "Date")
}

"""
Address State Create Input
"""
input StateInput {
    """
    Name of the country to display
    """
    name: String!
    """
    ID of Country to associate
    """
    country: String!
}

"""
Address State Update Input
"""
input StateUpdateInput {
    name: String
    country: String!
}

type States {
    totalCount: Int!
    data: [State]
}

extend type Query {
    states(criteria: AnyObject, limit: Int, skip: Int, sort: Sort): States!
    state(id: ID!): State!
}

extend type Mutation {
    createState(state: StateInput!): State!
    updateState(id: ID!, state: StateUpdateInput!): State!
    deleteState(id: ID!): Boolean!
}
