import { FormattedSegmentGeo, GeoAgg } from "@komi-app/fans-sdk";
import { getSDKConfig } from "config";
import { IFanGeoAggService } from "./FanGeoAggService";

export class FanGeoAggServiceV1 implements IFanGeoAggService {
  private geoAgg: GeoAgg;

  constructor() {
    this.geoAgg = new GeoAgg(getSDKConfig('fans'));
  }

  init (profileId: string) {
    this.geoAgg.init(profileId);
  }

  async getCountries(): Promise<FormattedSegmentGeo[]> {
    const res = await this.geoAgg.getCountries();

    return res.countries;
  }
  async getStates(): Promise<FormattedSegmentGeo[]> {
    const res = await this.geoAgg.getStates();

    return res.states;
  }
  async getCities(): Promise<FormattedSegmentGeo[]> {
    const res = await this.geoAgg.getCities();

    return res.cities;
  }
}