import gql from "graphql-tag";

export const QUERY_GROUPS_BY_MAKE_TYPE = gql`
  query QUERY_GROUPS_BY_MAKE_TYPE($make: String!, $type: jsonb, $date: date) {
    groupings(
      where: {
        _and: [
          { make: { _eq: $make } }
          { type: { _contains: $type } }
          { effective_date: { _lte: $date } }
          {
            _or: [
              { end_date: { _is_null: true } }
              { end_date: { _gt: $date } }
            ]
          }
        ]
      }
    ) {
      id
      group
      make
      type
    }
  }
`;
