package Database;

import lombok.Data;
import Gson.GsonFormatter;

/**
 * CityDetail class is a class that contains the details of a city.
 * <br/>Contains :
 * <br/>1. <b>CityName</b> , example : Tangerang
 * <br/>2. <b>AirportName</b>, example : Soekarno-Hatta International Airport
 * <br/>3. <b>AirportCode</b>, example : CGK
 * <br/>4. <b>StateCode</b>, example : Banten
 * <br/>5. <b>Country</b>, example : Indonesia
 */
@Data
@SuppressWarnings("unused")
public class CityDetail {
    // Example Tangerang
    private String CityName;
    // Example Soekarno-Hatta International Airport
    private String AirportName;
    // Example CGK
    private String AirportCode;
    // Example Banten
    private String StateCode;
    // Example Indonesia
    private String Country;

    public CityDetail(String CityName, String AirportName, String AirportCode, String StateCode, String Country){
        this.CityName = CityName;
        this.AirportName = AirportName;
        this.AirportCode = AirportCode;
        this.StateCode = StateCode;
        this.Country = Country;
    }

    public String toString(){
        return GsonFormatter.toJson(this);
    }

    @SuppressWarnings("unused")
    public static CityDetail fromJson(String json){
        return GsonFormatter.fromJson(json, CityDetail.class);
    }

    @SuppressWarnings("unused")
    public static CityDetail NewCityDetail(String CityName, String AirportName, String AirportCode, String StateCode, String Country){
        return new CityDetail(CityName, AirportName, AirportCode, StateCode, Country);
    }
}
