import { gql } from '@apollo/client/core';

// Mutations - exact from Proxyman

export const PROFILE_LIKE_MUTATION = gql`
  mutation ProfileLike($targetProfileId: String!) {
    profileLike(input: { targetProfileId: $targetProfileId }) {
      status
      chat {
        id
        name
        type
        streamChatId
        status
        members {
          id
          status
          analyticsId
          imaginaryName
          streamUserId
          age
          dateOfBirth
          sexuality
          isIncognito
          gender
          photos {
            id
            publicId
            pictureIsSafe
            pictureIsPrivate
            pictureUrl
            pictureUrls {
              small
              medium
              large
              __typename
            }
            pictureType
            __typename
          }
          __typename
        }
        __typename
      }
      __typename
    }
  }
`;

export const DEVICE_LOCATION_UPDATE_MUTATION = gql`
  mutation DeviceLocationUpdate($input: DeviceLocationInput!) {
    deviceLocationUpdate(input: $input) {
      id
      location {
        device {
          latitude
          longitude
          geocode {
            city
            country
            __typename
          }
          __typename
        }
        __typename
      }
      profiles {
        id
        location {
          ... on DeviceLocation {
            device {
              latitude
              longitude
              geocode {
                city
                country
                __typename
              }
              __typename
            }
            __typename
          }
          ... on TeleportLocation {
            current: device {
              city
              country
              __typename
            }
            teleport {
              latitude
              longitude
              geocode {
                city
                country
                __typename
              }
              __typename
            }
            __typename
          }
          __typename
        }
        __typename
      }
      __typename
    }
  }
`;

export const SEARCH_SETTINGS_UPDATE_MUTATION = gql`
  mutation SearchSettingsUpdate(
    $ageRange: [Int]
    $distanceMax: Float
    $desiringFor: [Desire!]
    $lookingFor: [LookingFor!]
    $recentlyOnline: Boolean
  ) {
    profileUpdate(
      input: {
        ageRange: $ageRange
        distanceMax: $distanceMax
        desiringFor: $desiringFor
        lookingFor: $lookingFor
        recentlyOnline: $recentlyOnline
      }
    ) {
      id
      ageRange
      distanceMax
      desiringFor
      lookingFor
      location {
        ... on DeviceLocation {
          device {
            latitude
            longitude
            geocode {
              city
              country
              __typename
            }
            __typename
          }
          __typename
        }
        ... on VirtualLocation {
          core
          __typename
        }
        ... on TeleportLocation {
          current: device {
            city
            country
            __typename
          }
          teleport {
            latitude
            longitude
            geocode {
              city
              country
              __typename
            }
            __typename
          }
          __typename
        }
        __typename
      }
      recentlyOnline
      __typename
    }
  }
`;

export const LAST_SEEN_UPDATE_MUTATION = gql`
  mutation LastSeenProviderUpdateProfile($profileId: String!) {
    lastSeenProviderUpdateProfile(profileId: $profileId) {
      id
      lastSeen
      __typename
    }
  }
`;

export const ACCOUNT_ADD_NOTIFICATION_TOKEN_MUTATION = gql`
  mutation AccountAddNotificationToken($token: String!) {
    accountAddNotificationToken(input: { token: $token })
  }
`;

export const PROFILE_PING_MUTATION = gql`
  mutation ProfilePing($targetProfileId: String!, $message: String, $overrideInappropriate: Boolean) {
    profilePing(
      input: {targetProfileId: $targetProfileId, message: $message, overrideInappropriate: $overrideInappropriate}
    ) {
      status
      chat {
        id
        name
        type
        streamChatId
        status
        members {
          id
          status
          analyticsId
          imaginaryName
          streamUserId
          age
          dateOfBirth
          sexuality
          isIncognito
          gender
          photos {
            id
            publicId
            pictureIsSafe
            pictureIsPrivate
            pictureUrl
            pictureUrls {
              small
              medium
              large
              __typename
            }
            pictureType
            __typename
          }
          __typename
        }
        disconnectedMembers {
          id
          __typename
        }
        __typename
      }
      account {
        id
        availablePings
        __typename
      }
      __typename
    }
  }
`;

export const PROFILE_UPDATE_MUTATION = gql`
  mutation ProfileUpdate($input: ProfileUpdateInput!) {
    profileUpdate(input: $input) {
      id
      age
      ageRange
      allowPWM
      bio
      hiddenBio
      hasHiddenBio
      completionStatus
      connectionGoals
      dateOfBirth
      desires
      distanceMax
      gender
      imaginaryName
      interests
      isIncognito
      lookingFor
      recentlyOnline
      sexuality
      status
      streamToken
      isParticipantToEventChat
      photos {
        id
        publicId
        pictureIsSafe
        pictureIsPrivate
        pictureUrl
        pictureUrls {
          small
          medium
          large
          __typename
        }
        __typename
      }
      __typename
    }
  }
`;

export const PROFILE_DISLIKE_MUTATION = gql`
  mutation ProfileDislike($targetProfileId: String!) {
    profileDislike(input: { targetProfileId: $targetProfileId })
  }
`;
