import type { Icon, DivIcon } from "leaflet";
import type { BaseResponse } from "@/app/[name]/(Main)/types/Types";

export interface Address {
  id: string;
  createdAt: string;
  updatedAt: string;
  deletedAt: string | null;
  user: string;
  title: string;
  address: string;
  city: string;
  province: string;
  postalCode: string;
  latitude: number;
  longitude: number;
  phone: string;
  isDefault: boolean;
}

export type AddressesResponse = BaseResponse<Address[]>;

export type AddressResponse = BaseResponse<Address>;

export type CreateAddressType = {
  title: string;
  address: string;
  city: string;
  province: string;
  postalCode: string;
  latitude: number;
  longitude: number;
  phone: string;
  isDefault: boolean;
};

export type UpdateAddressType = CreateAddressType & {
  id: string;
};

export interface MarkerData {
  position: [number, number];
  title: string;
  icon?: Icon | DivIcon;
}

export interface NominatimReverseGeocodingResponse {
  place_id: number;
  licence: string;
  osm_type: string;
  osm_id: number;
  lat: string;
  lon: string;
  class: string;
  type: string;
  place_rank: number;
  importance: number;
  addresstype: string;
  name: string;
  display_name: string;
  address: NominatimReverseGeocodingResponseAddress;
  boundingbox: string[];
}

export interface NominatimReverseGeocodingResponseAddress {
  road: string;
  neighbourhood: string;
  suburb: string;
  city: string;
  district: string;
  county: string;
  province: string;
  "ISO3166-2-lvl4": string;
  postcode: string;
  country: string;
  state: string;
  country_code: string;
}
