package com.sonymusic.dx.persistence.gras;

import jakarta.persistence.*;
import org.hibernate.type.YesNoConverter;

@Entity
@Table(name = "vgras017")
public class Country extends RAASEntity {

    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "country_key")
    private String countryKey;
    // should be foreign key but has no EJB for now
    @Column(name = "client_key")
    private String clientKey;
    @Column(name = "country_name")
    private String countryName;
    @Column(name = "isrc_country_code")
    private String isrcCountryCode;
    @Column(name = "iso_3166_A3_country_code")
    private String isoA3CountryCode;
    @Column(name = "iso_3166_N_country_code")
    private String isoNCountryCode;
    @Column(name = "is_active_flag")
    @Convert(converter = YesNoConverter.class)
    private Boolean isActive;
    @Column(name = "is_main_iso_A2_country")
    @Convert(converter = YesNoConverter.class)
    private Boolean isMainISOA2Country;

    /**
     * Protected, no-argument constructor should only be used by persistence engine.
     */
    protected Country() {}

    public String getCountryKey() {
        return countryKey;
    }

    public void setCountryKey(String countryKey) {
        this.countryKey = countryKey;
    }

    public String getClientKey() {
        return clientKey;
    }

    public void setClientKey(String clientKey) {
        this.clientKey = clientKey;
    }

    public String getCountryName() {
        return countryName;
    }

    public void setCountryName(String countryName) {
        this.countryName = countryName;
    }

    public String getIsrcCountryCode() {
        return isrcCountryCode;
    }

    public void setIsrcCountryCode(String isrcCountryCode) {
        this.isrcCountryCode = isrcCountryCode;
    }

    public String getIsoA3CountryCode() {
        return isoA3CountryCode;
    }

    public void setIsoA3CountryCode(String isoA3CountryCode) {
        this.isoA3CountryCode = isoA3CountryCode;
    }

    public String getIsoNCountryCode() {
        return isoNCountryCode;
    }

    public void setIsoNCountryCode(String isoNCountryCode) {
        this.isoNCountryCode = isoNCountryCode;
    }

    public Boolean getIsActive() {
        return isActive;
    }

    public void setIsActive(Boolean isActive) {
        this.isActive = isActive;
    }

    public Boolean getIsMainISOA2Country() {
        return isMainISOA2Country;
    }

    public void setIsMainISOA2Country(Boolean isMainISOA2Country) {
        this.isMainISOA2Country = isMainISOA2Country;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((countryKey == null) ? 0 : countryKey.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        final Country other = (Country) obj;
        if (countryKey == null) {
            if (other.countryKey != null)
                return false;
        } else if (!countryKey.equals(other.countryKey))
            return false;
        return true;
    }

}

