# Represents information about a company which is also a customer of the shop.
type Company implements CommentEventSubject&HasEvents&Navigable&Node {
    # The number of contacts that belong to the company.
    contactCount: Int!

    # The list of roles for the company contacts.
    contactRoles(
        first: Int
        after: String
        last: Int
        before: String
        reverse: Boolean = false
        sortKey: CompanyContactRoleSortKeys = ID
    ): CompanyContactRoleConnection!

    # The list of contacts in the company.
    contacts(
        first: Int
        after: String
        last: Int
        before: String
        reverse: Boolean = false
        sortKey: CompanyContactSortKeys = ID
        query: String
    ): CompanyContactConnection!

    # The date and time (ISO 8601 format) at which the company was created in Shopify.
    createdAt: DateTime!

    # The date and time (ISO 8601 format) at which the company became the customer.
    customerSince: DateTime!

    # A default cursor that returns the single next record, sorted ascending by ID.
    defaultCursor: String!

    # The role proposed by default for a contact at the company.
    defaultRole: CompanyContactRole

    # The list of the company's draft orders.
    draftOrders(
        first: Int
        after: String
        last: Int
        before: String
        reverse: Boolean = false
        sortKey: DraftOrderSortKeys = ID
        query: String
    ): DraftOrderConnection!

    # The paginated list of events associated with the host subject.
    events(
        first: Int
        after: String
        last: Int
        before: String
        reverse: Boolean = false
        sortKey: EventSortKeys = ID
        query: String
    ): EventConnection!

    # A unique externally-supplied identifier for the company.
    externalId: String

    # Whether the merchant added a timeline comment to the company.
    hasTimelineComment: Boolean!

    # A globally-unique identifier.
    id: ID!

    # The lifetime duration of the company, since it became a customer of the shop. Examples: 2 days, 3 months, 1 year.
    lifetimeDuration: String!

    # The number of locations that belong to the company.
    locationCount: Int!

    # The list of locations in the company.
    locations(
        first: Int
        after: String
        last: Int
        before: String
        reverse: Boolean = false
        sortKey: CompanyLocationSortKeys = ID
        query: String
    ): CompanyLocationConnection!

    # The main contact for the company.
    mainContact: CompanyContact

    # The name of the company.
    name: String!

    # A note about the company.
    note: String

    # The total number of orders placed for this company, across all its locations.
    orderCount: Int!

    # The list of the company's orders.
    orders(
        first: Int
        after: String
        last: Int
        before: String
        reverse: Boolean = false
        sortKey: OrderSortKeys = ID
    ): OrderConnection!

    # The total amount spent by this company, across all its locations.
    totalSpent: MoneyV2!

    # The date and time (ISO 8601 format) at which the company was last modified.
    updatedAt: DateTime!
}

# A person that acts on behalf of company associated to a customer.
type CompanyContact implements Node {
    # The company to which the contact belongs.
    company: Company!

    # The date and time (ISO 8601 format) at which the company contact was created at Shopify.
    createdAt: DateTime!

    # The customer associated to this contact.
    customer: Customer!

    # The list of draft orders for the company contact.
    draftOrders(
        first: Int
        after: String
        last: Int
        before: String
        reverse: Boolean = false
        sortKey: DraftOrderSortKeys = ID
        query: String
    ): DraftOrderConnection!

    # A globally-unique identifier.
    id: ID!

    # Whether the contact is the main contact of the company.
    isMainContact: Boolean!

    # The lifetime duration of the company contact, since its creation date on Shopify. Examples: 1 year, 2 months, 3 days.
    lifetimeDuration: String!

    # The company contact's locale (language).
    locale: String

    # The list of orders for the company contact.
    orders(
        first: Int
        after: String
        last: Int
        before: String
        reverse: Boolean = false
        sortKey: OrderSortKeys = ID
    ): OrderConnection!

    # The list of roles assigned to this company contact.
    roleAssignments(
        first: Int
        after: String
        last: Int
        before: String
        reverse: Boolean = false
        sortKey: CompanyContactRoleAssignmentSortKeys = ID
        query: String
    ): CompanyContactRoleAssignmentConnection!

    # The company contact's job title.
    title: String

    # The date and time (ISO 8601 format) at which the company contact was last updated.
    updatedAt: DateTime!
}

# The role for a company contact.
type CompanyContactRole implements Node {
    # A globally-unique identifier.
    id: ID!

    # The name of a role.
    # For example, admin or buyer.
    name: String!

    # A note for the role.
    note: String
}

# The CompanyContactRoleAssignment describes the company and location associated to a company contact's role.
type CompanyContactRoleAssignment implements Node {
    # The company this role assignment belongs to.
    company: Company!

    # The company contact for whom this role is assigned.
    companyContact: CompanyContact!

    # The company location to which the role is assigned.
    companyLocation: CompanyLocation!

    # The date and time (ISO 8601 format) when the assignment record was created.
    createdAt: DateTime!

    # A globally-unique identifier.
    id: ID!

    # The role that is assigned to the company contact.
    role: CompanyContactRole!

    # The date and time (ISO 8601 format) when the assignment record was last updated.
    updatedAt: DateTime!
}

# A location or branch of a company that's a customer of the shop.
# Configuration of B2B relationship, for example prices lists and checkout settings, may be done for a location.
type CompanyLocation implements CommentEventSubject&HasEvents&Navigable&Node {
    # The address used as billing address for the location.
    billingAddress: CompanyAddress

    # The configuration for the buyer's B2B checkout.
    buyerExperienceConfiguration: BuyerExperienceConfiguration

    # The company that the company location belongs to.
    company: Company!

    # The date and time (ISO 8601 format) at which the company location was created in Shopify.
    createdAt: DateTime!

    # The location's currency based on the shipping address. If the shipping address is empty, then the value is the shop's primary market.
    currency: CurrencyCode!

    # A default cursor that returns the single next record, sorted ascending by ID.
    defaultCursor: String!

    # The list of draft orders for the company location.
    draftOrders(
        first: Int
        after: String
        last: Int
        before: String
        reverse: Boolean = false
        sortKey: DraftOrderSortKeys = ID
        query: String
    ): DraftOrderConnection!

    # The paginated list of events associated with the host subject.
    events(
        first: Int
        after: String
        last: Int
        before: String
        reverse: Boolean = false
        sortKey: EventSortKeys = ID
        query: String
    ): EventConnection!

    # A unique externally-supplied identifier for the company location.
    externalId: String

    # Whether the merchant added a timeline comment to the company location.
    hasTimelineComment: Boolean!

    # A globally-unique identifier.
    id: ID!

    # The preferred locale of the company location.
    locale: String

    # The market that includes the location's shipping address. If the shipping address is empty, then the value is the shop's primary market.
    market: Market!

    # The name of the company location.
    name: String!

    # A note about the company location.
    note: String

    # The total number of orders placed for the location.
    orderCount: Int!

    # The list of orders for the company location.
    orders(
        first: Int
        after: String
        last: Int
        before: String
        reverse: Boolean = false
        sortKey: OrderSortKeys = ID
    ): OrderConnection!

    # The phone number of the company location.
    phone: String

    # The list of roles assigned to the company location.
    roleAssignments(
        first: Int
        after: String
        last: Int
        before: String
        reverse: Boolean = false
        sortKey: CompanyContactRoleAssignmentSortKeys = ID
        query: String
    ): CompanyContactRoleAssignmentConnection!

    # The address used as shipping address for the location.
    shippingAddress: CompanyAddress

    # The list of tax exemptions applied to the location.
    taxExemptions: [TaxExemption!]!

    # The tax registration ID for the company location.
    taxRegistrationId: String

    # The total amount spent by the location.
    totalSpent: MoneyV2!

    # The date and time (ISO 8601 format) at which the company location was last modified.
    updatedAt: DateTime!
}

# Represents a billing or shipping address for a company location.
type CompanyAddress implements Node {
    # The first line of the address. Typically the street address or PO Box number.
    address1: String!

    # The second line of the address. Typically the number of the apartment, suite, or unit.
    address2: String

    # The name of the city, district, village, or town.
    city: String

    # The name of the company.
    companyName: String!

    # The name of the country.
    country: String

    # The two-letter code for the country of the address.
    # For example, US.
    countryCode: CountryCode!

    # The date and time (ISO 8601 format) at which the company address was created.
    #
    # formattedAddress(withName: Boolean = falsewithCompanyName: Boolean = true): [String!]!
    # The formatted version of the address.
    createdAt: DateTime!

    # A comma-separated list of the values for city, province, and country.
    formattedArea: String

    # A globally-unique identifier.
    id: ID!

    # A unique phone number for the customer.
    # Formatted using E.164 standard. For example, +16135551111.
    phone: String

    # The region of the address, such as the province, state, or district.
    province: String

    # The identity of the recipient e.g. 'Receiving Department'.
    recipient: String

    # The date and time (ISO 8601 format) at which the company address was last updated.
    updatedAt: DateTime!

    # The zip or postal code of the address.
    zip: String

    # The two-letter code for the region.
    # For example, ON.
    zoneCode: String
}

# Settings describing the behavior of checkout for a B2B buyer.
type BuyerExperienceConfiguration {
    # Whether to checkout to draft order for merchant review.
    checkoutToDraft: Boolean!

    # Whether a buyer must pay at checkout or they can also choose to pay
    # later using net terms.
    payNowOnly: Boolean!

    # Represents the merchant configured payment terms.
    paymentTermsTemplate: PaymentTermsTemplate
}

# Represents information about the purchasing company for the order or draft order.
type PurchasingCompany {
    # The company associated to the order or draft order.
    company: Company!

    # The company contact associated to the order or draft order.
    contact: CompanyContact

    # The company location associated to the order or draft order.
    location: CompanyLocation!
}

# An auto-generated type for paginating through multiple CompanyContactRoles.
type CompanyContactRoleConnection {
    # A list of edges.
    edges: [CompanyContactRoleEdge!]!

    # A list of the nodes contained in CompanyContactRoleEdge.
    nodes: [CompanyContactRole!]!

    # Information to aid in pagination.
    pageInfo: PageInfo!
}

# An auto-generated type which holds one CompanyContactRole and a cursor during pagination.
type CompanyContactRoleEdge {
    # A cursor for use in pagination.
    cursor: String!

    # The item at the end of CompanyContactRoleEdge.
    node: CompanyContactRole!
}

# An auto-generated type for paginating through multiple CompanyContacts.
type CompanyContactConnection {
    # A list of edges.
    edges: [CompanyContactEdge!]!

    # A list of the nodes contained in CompanyContactEdge.
    nodes: [CompanyContact!]!

    # Information to aid in pagination.
    pageInfo: PageInfo!
}

# An auto-generated type which holds one CompanyContact and a cursor during pagination.
type CompanyContactEdge {
    # A cursor for use in pagination.
    cursor: String!

    # The item at the end of CompanyContactEdge.
    node: CompanyContact!
}

# An auto-generated type for paginating through multiple CompanyLocations.
type CompanyLocationConnection {
    # A list of edges.
    edges: [CompanyLocationEdge!]!

    # A list of the nodes contained in CompanyLocationEdge.
    nodes: [CompanyLocation!]!

    # Information to aid in pagination.
    pageInfo: PageInfo!
}

# An auto-generated type which holds one CompanyLocation and a cursor during pagination.
type CompanyLocationEdge {
    # A cursor for use in pagination.
    cursor: String!

    # The item at the end of CompanyLocationEdge.
    node: CompanyLocation!
}

# An auto-generated type for paginating through multiple CompanyContactRoleAssignments.
type CompanyContactRoleAssignmentConnection {
    # A list of edges.
    edges: [CompanyContactRoleAssignmentEdge!]!

    # A list of the nodes contained in CompanyContactRoleAssignmentEdge.
    nodes: [CompanyContactRoleAssignment!]!

    # Information to aid in pagination.
    pageInfo: PageInfo!
}

# An auto-generated type which holds one CompanyContactRoleAssignment and a cursor during pagination.
type CompanyContactRoleAssignmentEdge {
    # A cursor for use in pagination.
    cursor: String!

    # The item at the end of CompanyContactRoleAssignmentEdge.
    node: CompanyContactRoleAssignment!
}
