# Represents the data about a staff member's Shopify account.
# Merchants can use staff member data to get more information about the staff members in their store.
type StaffMember implements Node {
    # Whether the staff member is active.
    active: Boolean!

    # The image used as the staff member's avatar in the Shopify admin.
    avatar(fallback: StaffMemberDefaultImage = DEFAULT): Image!

    # The staff member's email address.
    email: String!

    # Whether the staff member's account exists.
    exists: Boolean!

    # The staff member's first name.
    firstName: String

    # A globally-unique identifier.
    id: ID!

    # The staff member's initials, if available.
    initials: [String!]

    # Whether the staff member is the shop owner.
    isShopOwner: Boolean!

    # The staff member's last name.
    lastName: String

    # The staff member's preferred locale. Locale values use the format language or language-COUNTRY, where language is a two-letter language code, and COUNTRY is a two-letter country code. For example: en or en-US
    locale: String!

    # The staff member's full name.
    name: String!

    # The staff member's phone number.
    phone: String

    # The data used to customize the Shopify admin experience for the staff member.
    privateData: StaffMemberPrivateData!
}

# Represents the data used to customize the Shopify admin experience for a logged-in staff member.
type StaffMemberPrivateData {
    # The URL to the staff member's account settings page.
    accountSettingsUrl: URL!

    # The date and time when the staff member was created.
    createdAt: DateTime!
}

# The record of when a customer consented to receive marketing material by email.
type CustomerEmailMarketingConsentState {
    # The date and time at which the customer consented to receive marketing material by email.
    # The customer's consent state reflects the consent record with the most recent consent_updated_at date.
    # If no date is provided, then the date and time at which the consent information was sent is used.
    consentUpdatedAt: DateTime

    # The marketing subscription opt-in level, as described by the M3AAWG best practices guidelines,
    # that the customer gave when they consented to receive marketing material by email.
    marketingOptInLevel: CustomerMarketingOptInLevel

    # The current email marketing state for the customer.
    marketingState: CustomerEmailMarketingState!
}

# The record of when a customer consented to receive marketing material by SMS.
#
# The customer's consent state reflects the record with the most recent date when consent was updated.
type CustomerSmsMarketingConsentState {
    # The source from which the SMS marketing information for the customer was collected.
    consentCollectedFrom: CustomerConsentCollectedFrom

    # The date and time when the customer consented to receive marketing material by SMS.
    # If no date is provided, then the date and time when the consent information was sent is used.
    consentUpdatedAt: DateTime

    # The marketing subscription opt-in level that was set when the customer consented to receive marketing information.
    marketingOptInLevel: CustomerMarketingOptInLevel!

    # The current SMS marketing state for the customer.
    marketingState: CustomerSmsMarketingState!
}

# A customer's computed statistics.
type CustomerStatistics {
    # The predicted spend tier of a customer with a shop.
    predictedSpendTier: CustomerPredictedSpendTier
}

# Represents a customer's session visiting a shop's online store,
# including information about the marketing activity attributed to starting the session.
type CustomerVisit implements CustomerMoment&Node {
    # A globally-unique identifier.
    id: ID!

    # URL of the first page the customer landed on for the session.
    landingPage: URL

    # Landing page information with URL linked in HTML.
    # For example, the first page the customer visited was store.myshopify.com/products/1.
    landingPageHtml: HTML

    # Represent actions taken by an app, on behalf of a merchant,
    # to market Shopify resources such as products, collections, and discounts.
    marketingEvent: MarketingEvent

    # The date and time when the customer's session occurred.
    occurredAt: DateTime!

    # Marketing referral code from the link that the customer clicked to visit the store.
    # Supports the following URL attributes: ref, source, or r.
    # For example, if the URL is myshopifystore.com/products/slide?ref=j2tj1tn2, then this value is j2tj1tn2.
    referralCode: String

    # Referral information with URLs linked in HTML.
    referralInfoHtml: FormattedString!

    # Webpage where the customer clicked a link that sent them to the online store.
    # For example, https://randomblog.com/page1 or android-app://com.google.android.gm.
    referrerUrl: URL

    # Source from which the customer visited the store, such as a platform (Facebook, Google), email, direct,
    # a website domain, QR code, or unknown.
    source: String!

    # Describes the source explicitly for first or last session.
    sourceDescription: String

    # Type of marketing tactic.
    sourceType: MarketingTactic

    # A set of UTM parameters gathered from the URL parameters of the referrer.
    utmParameters: UTMParameters
}

# A customer's payment method.
type CustomerPaymentMethod implements Node {
    # The customer to whom the payment method belongs.
    customer: Customer

    # The ID of this payment method.
    id: ID!

    # The instrument for this payment method.
    instrument: CustomerPaymentInstrument

    # The time that the payment method was revoked.
    revokedAt: DateTime

    # The revocation reason for this payment method.
    revokedReason: CustomerPaymentMethodRevocationReason

    # List Subscription Contracts.
    subscriptionContracts(
        first: Int
        after: String
        last: Int
        before: String
        reverse: Boolean = false
    ): SubscriptionContractConnection!
}

# Represents a customer's visiting activities on a shop's online store.
type CustomerJourneySummary {
    customerOrderIndex: Int
    # The position of the current order within the customer's order history. Test orders aren't included.

    # The number of days between the first session and the order creation date.
    # The first session represents the first session since the last order, or the first session within the 30 day attribution window, if more than 30 days have passed since the last order.
    daysToConversion: Int

    # The customer's first session going into the shop.
    firstVisit: CustomerVisit

    # The last session before an order is made.
    lastVisit: CustomerVisit

    # The events preceding a customer's order, such as shop sessions.
    moments(
        first: Int
        after: String
        last: Int
        before: String
        reverse: Boolean = false
    ): CustomerMomentConnection

    # The total number of customer moments associated with this order. Returns null if the order is still in the process of being attributed.
    momentsCount: Int

    # Whether the attributed sessions for the order have been created yet.
    ready: Boolean!
}

# Represents a card instrument for customer payment method.
type CustomerCreditCard {
    # The billing address of the card.
    billingAddress: CustomerCreditCardBillingAddress

    # The brand of the card.
    brand: String!

    # Whether the card is about to expire.
    expiresSoon: Boolean!

    # The expiry month of the card.
    expiryMonth: Int!

    # The expiry year of the card.
    expiryYear: Int!

    # The card's BIN number.
    firstDigits: String

    # The payment method can be revoked if there are no active subscription contracts.
    isRevocable: Boolean!

    # The last 4 digits of the card.
    lastDigits: String!

    # The masked card number with only the last 4 digits displayed.
    maskedNumber: String!

    # The name of the card holder.
    name: String!

    # The source of the card if coming from a wallet such as Apple Pay.
    source: String

    # The last 4 digits of the Device Account Number.
    virtualLastDigits: String
}

# The billing address of a credit card payment instrument.
type CustomerCreditCardBillingAddress {
    # The first line of the address. Typically the street address or PO Box number.
    address1: String

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

    # The name of the country.
    country: String

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

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

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

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

# Represents a PayPal instrument for customer payment method.
type CustomerPaypalBillingAgreement {
    # The billing address of this payment method.
    billingAddress: CustomerPaymentInstrumentBillingAddress

    # Whether the PayPal billing agreement is inactive.
    inactive: Boolean!

    # Whether the payment method can be revoked.The payment method can be revoked if there are no active subscription contracts.
    isRevocable: Boolean!

    # The customers's PayPal account email address.
    paypalAccountEmail: String
}

# The billing address of a payment instrument.
type CustomerPaymentInstrumentBillingAddress {
    # The first line of the address. Typically the street address or PO Box number.
    address1: String

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

    # The name of the country.
    country: String

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

    # The name of the buyer of the address.
    name: String

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

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

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

# Represents a Shop Pay card instrument for customer payment method.
type CustomerShopPayAgreement {
    # Whether the card is about to expire.
    expiresSoon: Boolean!

    # The expiry month of the card.
    expiryMonth: Int!

    # The expiry year of the card.
    expiryYear: Int!

    # Whether the Shop Pay billing agreement is inactive.
    inactive: Boolean!

    # The payment method can be revoked if there are no active subscription contracts.
    isRevocable: Boolean!

    # The last 4 digits of the card.
    lastDigits: String!

    # The masked card number with only the last 4 digits displayed.
    maskedNumber: String!

    # The name of the card holder.
    name: String!
}

# An auto-generated type for paginating through multiple CustomerMoments.
type CustomerMomentConnection {
    # A list of edges.
    edges: [CustomerMomentEdge!]!

    # A list of the nodes contained in CustomerMomentEdge.
    nodes: [CustomerMoment!]!

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

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

    # The item at the end of CustomerMomentEdge.
    node: CustomerMoment!
}

# An auto-generated type for paginating through multiple StaffMembers.
type StaffMemberConnection {
    # A list of edges.
    edges: [StaffMemberEdge!]!

    # A list of the nodes contained in StaffMemberEdge.
    nodes: [StaffMember!]!

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

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

    # The item at the end of StaffMemberEdge.
    node: StaffMember!
}
