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

import java.time.LocalDateTime;
import java.util.Objects;
import java.util.StringJoiner;

/**
 * Diese Klasse dient der Darstellung aller Reden eines Parlamentariers.
 */
public class SpeechMetaData {
    // aus "speech" Collection
    String  speechKey;      // z.B. "ID2011400300"
    int     speechId;      // TODO: nötig?
    int     speakerId;
    String  speakerName;
    String  fraktion;
    int     sessionId;      // TODO: nötig?

    // aus "sessions" Collection
    LocalDateTime       dateTime;
    String              dateTimeString;

    // aus "agendaItems" Collection
    String              agendaTitle;

    public String getSpeechKey() {
        return speechKey;
    }

    public void setSpeechKey(String speechKey) {
        this.speechKey = speechKey;
    }

    public int getSpeechId() {
        return speechId;
    }

    public void setSpeechId(int speechId) {
        this.speechId = speechId;
    }

    public int getSpeakerId() {
        return speakerId;
    }

    public void setSpeakerId(int speakerId) {
        this.speakerId = speakerId;
    }

    public String getSpeakerName() {return speakerName;}

    public void setSpeakerName(String speakerName) {this.speakerName = speakerName;}

    public String getFraktion() {return fraktion;}

    public void setFraktion(String fraktion) {this.fraktion = fraktion;}

    public int getSessionId() {
        return sessionId;
    }

    public void setSessionId(int sessionId) {
        this.sessionId = sessionId;
    }

    public LocalDateTime getDateTime() {
        return dateTime;
    }

    public void setDateTime(LocalDateTime dateTime) {
        this.dateTime = dateTime;
    }

    public String getDateTimeString() {
        return dateTimeString;
    }

    public void setDateTimeString(String dateTimeString) {
        this.dateTimeString = dateTimeString;
    }

    public String getAgendaTitle() {
        return agendaTitle;
    }

    public void setAgendaTitle(String agendaTitle) {
        this.agendaTitle = agendaTitle;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof SpeechMetaData that)) return false;
        return speechId == that.speechId && speakerId == that.speakerId && sessionId == that.sessionId
                && Objects.equals(speechKey, that.speechKey) && Objects.equals(speakerName, that.speakerName)
                && Objects.equals(fraktion, that.fraktion) && Objects.equals(dateTime, that.dateTime)
                && Objects.equals(dateTimeString, that.dateTimeString) && Objects.equals(agendaTitle, that.agendaTitle);
    }

    @Override
    public int hashCode() {
        return Objects.hash(speechKey, speechId, speakerId, speakerName, fraktion, sessionId, dateTime, dateTimeString, agendaTitle);
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", SpeechMetaData.class.getSimpleName() + "[", "]")
                .add("speechKey='" + speechKey + "'")
                .add("speechId=" + speechId)
                .add("speakerId=" + speakerId)
                .add("speakerName='" + speakerName + "'")
                .add("fraktion='" + fraktion + "'")
                .add("sessionId=" + sessionId)
                .add("dateTime=" + dateTime)
                .add("dateTimeString='" + dateTimeString + "'")
                .add("agendaTitle='" + agendaTitle + "'")
                .toString();
    }
}
