package org.texttechnologylab.project.gruppe_05_1.xml.speeches.Impls;

import org.apache.uima.UIMAException;
import org.apache.uima.jcas.JCas;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.Content;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.Speech;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.enums.MongoDBEntryType;


import java.util.ArrayList;
import java.util.List;

public class Speech_File_Impl implements Speech {
    private final int sessionId;
    private final int agendaItemId;
    private final int speakerId;
    private final int speechId;
    private final String speakerName;
    private final String fraction;
    private final List<Content> speechContents;
    private final String speechKey;

    @Override
    public int getSessionId() {
        return sessionId;
    }

    @Override
    public int getAgendaItemId() {
        return agendaItemId;
    }

    @Override
    public int getSpeakerId() {
        return speakerId;
    }

    @Override
    public int getSpeechId() {
        return speechId;
    }

    @Override
    public String getSpeakerName() {
        return speakerName;
    }

    @Override
    public String getFraction() {
        return fraction;
    }

    @Override
    public List<Content> getSpeechContents() {
        return speechContents;
    }

    @Override
    public String getSpeechKey() {
        return speechKey;
    }

    public Speech_File_Impl(int sessionId, int agendaItemId, int speechId, int speakerId, String speakerName, String fraction, String speechKey) {
        this.speakerId = speakerId;
        this.agendaItemId = agendaItemId;
        this.speechId = speechId;
        this.speakerName = speakerName;
        this.fraction = fraction;
        this.sessionId = sessionId;
        this.speechKey = speechKey;
        this.speechContents = new ArrayList<>();
    }

    @Override
    public MongoDBEntryType getType() {
        return MongoDBEntryType.SPEECH;
    }

    public void addContent(Content content) {
        this.speechContents.add(content);
        //Logger.pink("Added paragraph to speech: " + paragraph);
    }

    @Override
    public String toHTML() {
        //TODO: Implement a logic that highlights the lines that the speaker is saying
        return "<div class='speech'>"
                + "<h2>Speech Details</h2>"
                + "<p><strong>Session ID:</strong> " + sessionId + "</p>"
                + "<p><strong>Speaker ID:</strong> " + speakerId + "</p>"
                + "<p><strong>Speaker Name:</strong> " + speakerName + "</p>"
                + "<p><strong>Fraction:</strong> " + fraction + "</p>"
                + "</div>";
    }

    @Override
    public String getFullText() {
        return "";
    }

    @Override
    public JCas toCas() throws UIMAException {
        return null;
    }

}
