package org.texttechnologylab.project.gruppe_05_1.database;

import org.bson.Document;
import org.texttechnologylab.project.gruppe_05_1.database.domainimpl.mdb.*;
import org.texttechnologylab.project.gruppe_05_1.domain.mdb.*;
import org.texttechnologylab.project.gruppe_05_1.domain.speaker.Membership;
import org.texttechnologylab.project.gruppe_05_1.domain.speaker.Speaker;

import java.util.List;

public class MongoObjectFactory {

    private static MongoObjectFactory factory = null;

    /**
     *
     * @return MongoObjectFactory
     */
    public static MongoObjectFactory getFactory() {
        if (factory == null) {
            factory = new MongoObjectFactory();
        }
        return factory;
    }

    /*
     *      *** MDB Strukturen ***
     *      =====================
     */
    public Document createBiografischeAngaben(BiografischeAngaben entity) {
        return new BiografischeAngaben_Mongo_Impl().createEntity(entity);
    }

    public Document createInstitution(Institution entity) {
        return new Institution_Mongo_Impl().createEntity(entity);
    }

    public Document createMdb(Mdb entity) {
        return new Mdb_Mongo_Impl().createEntity(entity);
    }

    public Document createMdbName(MdbName entity) {
        return new MdbName_Mongo_Impl().createEntity(entity);
    }

    public Document createWahlperiode(Wahlperiode entity) {
        return new Wahlperiode_Mongo_Impl().createEntity(entity);
    }

    /*
     *      *** Speaker Strukturen ***
     *      ========================
     */
    public Document createSpeaker(Speaker entity) {
        return new Speaker_Mongo_Impl().createEntity(entity);
    }

    public Document createMembership(Membership entity) {
        return new Membership_Mongo_Impl().createEntity(entity);
    }

    public List<Document> createMemberships(List<Membership> list) {
        return new Membership_Mongo_Impl().createList(list);
    }
}
