aboutsummaryrefslogtreecommitdiff
path: root/src/models/country.model.ts
blob: 3ebe2b44a85461eb0ed65f880a250f108cff522d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// For better currency types, this can be used later:
// https://github.com/freeall/currency-codes
// Same can be done for language abbreviations
type CurrencyAbbr = string;
type CurrencyInfo = { name: string; symbol: string };
type LangAbbr = string;
type ImageFormat = "png" | "svg";
type Flags = Record<ImageFormat, string>;

export type Currencies = Record<CurrencyAbbr, CurrencyInfo>;
export type Languages = Record<LangAbbr, string>;
export enum Region {
  Asia = "Asia",
  Europe = "Europe",
  Americas = "Americas",
  Africa = "Africa",
  Oceania = "Oceania",
  Antarctic = "Antarctic",
}

export interface Country {
  name: {
    common: string;
    official: string;
    // Need type for nativeName later
  };
  currencies: Currencies;
  capital: string[];
  flag: string;
  population: number;
  languages: Languages;
  region: Region;
  subregion: string; //can later be explicit enum
  timezones: string[];
  latlng: number[];
  capitalInfo: {
    latlng: number[];
  };
  tld: string[];
  flags: Flags;
}