export interface AddressComponents {
  place_name: string | null;
  house: string | null;
  road: string | null;
}

export interface AreaComponents {
  area: string | null;
  sub_area: string | null;
}

export interface ReverseGeocodeResult {
  id: number;
  distance_within_meters: number;
  address?: string; // Made optional
  area: string;
  city: string;
  postCode?: string;
  address_bn?: string; // Made optional
  area_bn?: string;
  city_bn?: string;
  country?: string;
  division?: string;
  district?: string;
  sub_district?: string;
  pauroshova?: string | null;
  union?: string | null;
  location_type?: string;
  address_components?: AddressComponents; // Made optional
  area_components?: AreaComponents;
}

export interface ReverseGeocodeOptions {
  longitude: number;
  latitude: number;
  district?: boolean;
  post_code?: boolean;
  country?: boolean;
  country_code?: string;
  sub_district?: boolean;
  union?: boolean;
  pauroshova?: boolean;
  location_type?: boolean;
  division?: boolean;
  address?: boolean;
  area?: boolean;
  bangla?: boolean;
}

export interface AutocompleteResult {
  id: number;
  longitude: string;
  latitude: string;
  address: string;
  city: string;
  area: string;
  postCode: number;
  pType: string;
  uCode: string;
  address_bn?: string;
  city_bn?: string;
  area_bn?: string;
}

export interface AutocompleteOptions {
  q: string;
  area?: string;
  city?: string;
  bangla?: boolean;
  country_code?: string;
  post_office?: boolean;
  industrial?: boolean;
}

export interface NearbyResult {
  id: number;
  name: string;
  distance_in_meters: string;
  longitude: string;
  latitude: string;
  city: string;
  area: string;
  ST_AsText_location: string;
  pType: string;
  subType: string;
  postCode: string;
  Address: string;
  uCode: string;
}

export interface NearbyOptions {
  longitude: number;
  latitude: number;
}

export interface GeocodedAddress {
  Address: string;
  address: string;
  address_bn: string;
  alternate_address: string;
  area: string;
  area_bn: string;
  bounds: string;
  business_name: string;
  city: string;
  city_bn: string;
  created_at: string;
  district: string;
  geo_location: [number, number];
  holding_number: string | null;
  id: number;
  latitude: string;
  location: string;
  location_shape: string;
  longitude: string;
  match_freq: number;
  match_fuzzy: number;
  matching_diff: number;
  new_address: string;
  pType: string;
  place_code: string;
  popularity_ranking: number;
  postCode: string;
  postcode: string;
  road_name_number: string | null;
  score: number;
  subType: string;
  sub_area: string;
  sub_district: string;
  sub_type: string;
  super_sub_area: string;
  thana: string;
  type: string;
  uCode: string;
  union: string | null;
  unions: string[] | null;
  updated_at: string;
  user_id: number;
}

export interface RupantorResult {
  given_address: string;
  fixed_address: string;
  bangla_address?: string;
  address_status: string;
  geocoded_address: GeocodedAddress;
  confidence_score_percentage: number;
  status: number;
}

export interface RupantorOptions {
  q: string;
  thana?: string;
  district?: string;
  bangla?: boolean;
}
