import gql from 'graphql-tag';

export const UPDATE_CUSTOMER = gql`
  mutation UpdateCustomer($input: UpdateCustomerInput!) {
    updateCustomer(input: $input) {
      customer {
        id
        nickname
        title
        email
        primaryPhoneNumber
        isEmailVerified
        isPhoneNumberVerified
        name
      }
      error {
        message
        code
      }
    }
  }
`;

export const SEND_EMAIL_VERIIFICATION_CHALLENGE = gql`
  mutation SendEmailVerificationChallenge($input: EmailVerificationChallengeInput) {
    sendEmailVerificationChallenge(input: $input) {
      emailVerificationChallenge {
        email
        id
        challengeDate
      }
    }
  }
`;

export const ADD_CUSTOMER = gql`
  mutation AddCustomer($input: AddCustomerInput!) {
    addCustomer(input: $input) {
      customer {
        id
        email
        primaryPhoneNumber
        nationalId
        name
        legalEntity {
          ... on Person {
            address
            postCode
          }
          ... on Organization {
            address
            postCode
          }
        }
      }
      error {
        code
        message
      }
    }
  }
`;
