import gql from "graphql-tag";
export const QUERY_BODYSHOP = gql`
  query QUERY_BODYSHOP {
    bodyshops {
      id
      shopname
      targets
      accepted_ins_co
      groups
      ppd_diff_alert
      features
      channel
      zip_post
      phone
      es_api_key
      mpi_count_quantity
      ins_rule_set
    }
    targets {
      id
      ins_co
      name
      group
      ageLt
      ageGte
      target
      effective_date
      end_date
    }
  }
`;

export const UPDATE_SHOP = gql`
  mutation UPDATE_SHOP($id: uuid, $shop: bodyshops_set_input!) {
    update_bodyshops(where: { id: { _eq: $id } }, _set: $shop) {
      returning {
        id
        shopname
        targets
        accepted_ins_co
        groups
        ppd_diff_alert
        features
              zip_post
      phone
      es_api_key
      mpi_count_quantity
      }
    }
  }
`;

export const QUERY_NOTIFICATIONS = gql`
  query QUERY_NOTIFICATIONS($now: timestamptz) {
    notifications(
      where: { acceptedat: { _is_null: true }, effectivedate: { _lte: $now } }
    ) {
      effectivedate
      html
      id
      requiresconfirmation
      requiresconfirmationby
      updated_at
    }
  }
`;
