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

import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.Fraction;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.enums.MongoDBEntryType;


import java.util.List;

public class Fraction_File_Impl implements Fraction {
    private String name;
    private final String longName;
    private final List<Integer> members;

    @Override
    public String getName() {
        return name;
    }

    @Override
    public String getLongName() {
        return longName;
    }

    @Override
    public List<Integer> getMembers() {
        return members;
    }

    public Fraction_File_Impl(String name, String longName, List<Integer> members) {
        this.name = name;
        this.longName = longName;
        this.members = members;
    }

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

    @Override
    public void addMember(int member) {
        this.members.add(member);
    }

    @Override
    public void updateName(String name) {
        this.name = name;
    }

    @Override
    public String toHTML() {
        return "<div class='fraction'>"
                + "<h2>Fraction Details</h2>"
                + "<p><strong>Name:</strong> " + name + "</p>"
                + "<p><strong>Long Name:</strong> " + longName + "</p>"
                + "</div>";
    }
}
