export const typeDefs = /* GraphQL */ `
  scalar JSON

  enum VoiceExperienceStatus {
    UPLOADED
    TRANSCRIBING
    TRANSCRIBED
    ANALYZING
    ANALYZED
    FAILED
  }

  type Place {
    id: ID!
    googlePlaceId: String!
    name: String!
    latitude: Float!
    longitude: Float!
    googlePrimaryType: String
    googleTypes: [String!]!
    googleBusinessStatus: String
    googleRating: Float
    googleUserRatingCount: Int
    googleRegularOpeningHours: JSON
    googleCurrentOpeningHours: JSON
    googlePayload: JSON
    googlePhotos: JSON
    photoUrls: [String!]!
    photoAttributions: JSON
    traits: [String!]!
    isFavorite: Boolean!
    experiences: [VoiceExperience!]!
  }

  type User {
    id: ID!
    telegramId: String!
    username: String
    firstName: String
    lastName: String
    photoUrl: String
    languageCode: String
    isAdmin: Boolean!
  }

  type VoiceExperience {
    id: ID!
    place: Place!
    user: User
    status: VoiceExperienceStatus!
    durationSeconds: Int!
    audioObjectKey: String!
    transcript: String
    analysis: JSON
    recordingPayload: JSON
    promptHintsShown: [String!]!
    createdAt: String!
  }

  input CreateVoiceExperienceInput {
    googlePlaceId: String!
    googleName: String!
    latitude: Float!
    longitude: Float!
    googlePrimaryType: String
    googleTypes: [String!] = []
    durationSeconds: Int!
    audioObjectKey: String!
    audioContentBase64: String!
    audioMimeType: String!
    addToFavorites: Boolean = false
    recordingPayload: JSON
    promptHintsShown: [String!] = []
  }

  input NearbyPlacesInput {
    latitude: Float!
    longitude: Float!
    radiusMeters: Int!
  }

  input VoicePlaceRecommendationsInput {
    audioContentBase64: String!
    audioMimeType: String!
  }

  input AuthenticateTelegramInput {
    initData: String!
  }

  input AuthenticateTelegramLoginInput {
    id: Float!
    first_name: String
    last_name: String
    username: String
    photo_url: String
    auth_date: Float!
    hash: String!
  }

  type AuthPayload {
    user: User!
  }

  type TelegramBotLoginPayload {
    token: String!
    botUrl: String!
    expiresAt: String!
  }

  type TelegramBotLoginSession {
    sessionToken: String!
    user: User!
  }

  type VoicePlaceRecommendationsPayload {
    transcript: String!
    tags: [String!]!
    summary: String!
    places: [Place!]!
  }

  type Query {
    health: String!
    me: User!
    places: [Place!]!
    favoritePlaces: [Place!]!
    nearbyPlaces(input: NearbyPlacesInput!): [Place!]!
    voiceExperiences: [VoiceExperience!]!
  }

  type Mutation {
    startTelegramBotLogin: TelegramBotLoginPayload!
    completeTelegramBotLogin(token: String!): TelegramBotLoginSession!
    authenticateTelegram(input: AuthenticateTelegramInput!): AuthPayload!
    authenticateTelegramLogin(input: AuthenticateTelegramLoginInput!): AuthPayload!
    createVoiceExperience(input: CreateVoiceExperienceInput!): VoiceExperience!
    recommendPlacesByVoice(input: VoicePlaceRecommendationsInput!): VoicePlaceRecommendationsPayload!
    addFavoritePlace(placeId: ID!): Place!
    removeFavoritePlace(placeId: ID!): Place!
  }
`;
