# frozen_string_literal: true module Billfixers module Partner PROVIDER_FRAGMENT = %( id name services ) CUSTOMER_FRAGMENT = %( id email name firstName lastName phoneNumber avatarUrl b2b addressLine1 addressLine2 addressCity addressState addressPostalCode addressCountryCode createdAt updatedAt ) BILL_ITEM_FRAGMENT = %( name prePrice postPrice duration savings savingsStartOn savingsEndOn underContract createdAt updatedAt ) BILL_FRAGMENT = %( id status title providerId totalSavings createdAt updatedAt items { #{BILL_ITEM_FRAGMENT} } customer { #{CUSTOMER_FRAGMENT} } provider { #{PROVIDER_FRAGMENT} } ) OFFER_FRAGMENT = %( id status content contentHtml createdAt updatedAt acceptedAt rejectedAt customer { #{CUSTOMER_FRAGMENT} } bill { #{BILL_FRAGMENT} } ) LIST_PROVIDERS_QUERY = %( query { ListProviders { #{PROVIDER_FRAGMENT} } } ) LIST_CUSTOMERS_QUERY = %( query($limit: Int, $offset: Int) { ListCustomers( limit: $limit, offset: $offset ) { totalCount nodes { #{CUSTOMER_FRAGMENT} } } } ) LIST_BILLS_QUERY = %( query($limit: Int, $offset: Int, $customer_id: ID) { ListBills( limit: $limit, offset: $offset, customerId: $customer_id ) { totalCount nodes { #{BILL_FRAGMENT} } } } ) LIST_OFFERS_QUERY = %( query($limit: Int, $offset: Int, $customer_id: ID, $bill_id: ID, $status: String) { ListOffers( limit: $limit, offset: $offset, customerId: $customer_id, billId: $bill_id, status: $status ) { totalCount nodes { #{OFFER_FRAGMENT} } } } ) FIND_CUSTOMER_QUERY = %( query($id: ID!) { FindCustomer(id: $id) { #{CUSTOMER_FRAGMENT} } } ) FIND_BILL_QUERY = %( query($id: ID!) { FindBill(id: $id) { #{BILL_FRAGMENT} } } ) CREATE_CUSTOMER_MUTATION = %( mutation($customer: CustomerAttributes!) { CreateCustomer(input: { customer: $customer }) { success errors customer { #{CUSTOMER_FRAGMENT} } } } ) CREATE_BILL_MUTATION = %( mutation($bill: BillAttributes!) { CreateBill(input: { bill: $bill }) { success errors bill { #{BILL_FRAGMENT} } } } ) CANCEL_BILL_MUTATION = %( mutation($id: ID!) { CancelBill(input: { id: $id }) { success } } ) ACCEPT_OFFER_MUTATION = %( mutation($id: ID!) { AcceptOffer(input: { id: $id }) { success errors offer { #{OFFER_FRAGMENT} } } } ) REJECT_OFFER_MUTATION = %( mutation($id: ID!) { RejectOffer(input: { id: $id }) { success errors offer { #{OFFER_FRAGMENT} } } } ) end end