import { gql } from '@apollo/client/core';
import {
  DISCOVERY_ANALYTICS_METADATA_FRAGMENT,
  LIKES_PROFILE_FRAGMENT,
  PICTURE_FRAGMENT,
} from './queries';

// pastLikes / pastDislikes — shapes verbatim from live app v8.11.0.
// LikesProfileFragment lives in queries.ts (single source of truth, also used
// by FilteredWhoLikesMe / FilteredWhoPingsMe mutations).

export const PAST_LIKES_QUERY = gql`
  ${LIKES_PROFILE_FRAGMENT}
  ${DISCOVERY_ANALYTICS_METADATA_FRAGMENT}
  ${PICTURE_FRAGMENT}
  query pastLikes($cursor: String, $input: PastLikesQueryInput!, $limit: Int) {
    pastLikes(cursor: $cursor, input: $input, limit: $limit) {
      nodes {
        isPing
        interactionSentAt
        profile {
          ...LikesProfileFragment
          ...DiscoveryAnalyticsMetadata
          photos {
            ...GetPictureUrlFragment
            __typename
          }
          __typename
        }
        __typename
      }
      pageInfo {
        hasNextPage
        nextPageCursor
        total
        unfilteredTotal
        __typename
      }
      __typename
    }
  }
`;

export const PAST_DISLIKES_QUERY = gql`
  ${LIKES_PROFILE_FRAGMENT}
  ${DISCOVERY_ANALYTICS_METADATA_FRAGMENT}
  ${PICTURE_FRAGMENT}
  query pastDislikes($cursor: String, $input: PastDislikesQueryInput!, $limit: Int) {
    pastDislikes(cursor: $cursor, input: $input, limit: $limit) {
      nodes {
        interactionSentAt
        profile {
          ...LikesProfileFragment
          ...DiscoveryAnalyticsMetadata
          photos {
            ...GetPictureUrlFragment
            __typename
          }
          __typename
        }
        __typename
      }
      pageInfo {
        hasNextPage
        nextPageCursor
        total
        unfilteredTotal
        __typename
      }
      __typename
    }
  }
`;
