import type { CoordinateSystem, GeoPoint } from '@/domain/poi'

export type CheckInBadgeCode = 'explorer' | 'traveller' | 'check_in_master'
export type CheckInEligibilityCode = 'eligible' | 'too_far' | 'uncertain' | 'low_accuracy' | 'invalid_location'

export interface CheckInLocationSnapshot extends GeoPoint {
  accuracy: number | null
  receivedAt: string
  coordinateSystem: CoordinateSystem
}

export interface CheckInRecord {
  id: string
  poiId: string
  poiName: string
  checkedInAt: string
  pointsAwarded: number
}

export interface CheckInBadge {
  code: CheckInBadgeCode
  obtainedAt: string
}

export interface CheckInProfile {
  points: number
  badges: CheckInBadge[]
  checkIns: CheckInRecord[]
}

export interface CheckInEligibility {
  eligible: boolean
  code: CheckInEligibilityCode
  distanceMeters: number | null
  allowedDistanceMeters: number
  message: string
}

export interface CheckInResult {
  profile: CheckInProfile
  record: CheckInRecord
  newBadges: CheckInBadge[]
}

export interface CheckInBadgeDefinition {
  code: CheckInBadgeCode
  name: string
  description: string
  icon: string
  requiredCheckIns: number
}
