package org.texttechnologylab.project.gruppe_05_1.domain.mdb;

import java.time.LocalDate;
import java.util.List;
import java.util.Objects;
import java.util.StringJoiner;

public abstract class Wahlperiode {

    private int                     wp;
    private LocalDate               mdbWpVon;
    private LocalDate               mdbWpBis;
    private String                     wknNr;          // String, nicht int, weil manchmal leer
    private String                  wkrName;
    private String                  wkrLand;
    private String                  liste;
    private Mandatsart              mandatsart;
    private List<Institution>       institutionen;

    public int getWp() {
        return wp;
    }

    public void setWp(int wp) {
        this.wp = wp;
    }

    public LocalDate getMdbWpVon() {
        return mdbWpVon;
    }

    public void setMdbWpVon(LocalDate mdbWpVon) {
        this.mdbWpVon = mdbWpVon;
    }

    public LocalDate getMdbWpBis() {
        return mdbWpBis;
    }

    public void setMdbWpBis(LocalDate mdbWpBis) {
        this.mdbWpBis = mdbWpBis;
    }

    public String getWknNr() {
        return wknNr;
    }

    public void setWknNr(String wknNr) {
        this.wknNr = wknNr;
    }

    public String getWkrName() {
        return wkrName;
    }

    public void setWkrName(String wkrName) {
        this.wkrName = wkrName;
    }

    public String getWkrLand() {
        return wkrLand;
    }

    public void setWkrLand(String wkrLand) {
        this.wkrLand = wkrLand;
    }

    public String getListe() {
        return liste;
    }

    public void setListe(String liste) {
        this.liste = liste;
    }

    public Mandatsart getMandatsart() {
        return mandatsart;
    }

    public void setMandatsart(Mandatsart mandatsart) {
        this.mandatsart = mandatsart;
    }

    public List<Institution> getInstitutionen() {
        return institutionen;
    }

    public void setInstitutionen(List<Institution> institutionen) {
        this.institutionen = institutionen;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Wahlperiode that)) return false;
        return wp == that.wp && Objects.equals(wknNr, that.wknNr) && Objects.equals(mdbWpVon, that.mdbWpVon) && Objects.equals(mdbWpBis, that.mdbWpBis) && Objects.equals(wkrName, that.wkrName) && Objects.equals(wkrLand, that.wkrLand) && Objects.equals(liste, that.liste) && mandatsart == that.mandatsart && Objects.equals(institutionen, that.institutionen);
    }

    @Override
    public int hashCode() {
        return Objects.hash(wp, mdbWpVon, mdbWpBis, wknNr, wkrName, wkrLand, liste, mandatsart, institutionen);
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", Wahlperiode.class.getSimpleName() + "[", "]")
                .add("wp=" + wp)
                .add("mdbWpVon=" + mdbWpVon)
                .add("mdbWpBis=" + mdbWpBis)
                .add("wknNr=" + wknNr)
                .add("wkrName='" + wkrName + "'")
                .add("wkrLand='" + wkrLand + "'")
                .add("liste='" + liste + "'")
                .add("mandatsart=" + mandatsart)
                .add("institutionen=" + institutionen)
                .toString();
    }
}
