package com.capgemini.reports.definition.r23report.visitors.snecmaobject;

import com.capgemini.reports.definition.r23report.visitors.R23VisitorKeys;
import com.capgemini.reports.snecmaobjects.ISnecmaObject;
import com.capgemini.reports.snecmaobjects.admin.RFAdminAGRevision;
import com.capgemini.reports.snecmaobjects.admin.RFAdminAPRevision;
import com.capgemini.reports.snecmaobjects.admin.RFAdminARevision;
import com.capgemini.reports.snecmaobjects.admin.RFAdminRevision;
import com.capgemini.reports.snecmaobjects.descriptif.DescriptifRevision;
import com.capgemini.reports.snecmaobjects.generic.GenericAssembRevision;
import com.capgemini.reports.snecmaobjects.generic.GenericRevision;
import com.capgemini.reports.snecmaobjects.mockup.MockupRevision;
import com.capgemini.reports.snecmaobjects.part.*;
import com.capgemini.reports.snecmaobjects.product.ProductRevision;
import com.capgemini.reports.snecmaobjects.rf.RFGenericRevision;
import com.capgemini.reports.snecmaobjects.rf.RFPartAssembRevision;
import com.capgemini.reports.snecmaobjects.rf.RFPartRevision;
import com.capgemini.reports.snecmaobjects.supermodel.SuperModelRevision;
import com.capgemini.reports.snecmaobjects.visitor.IReceptorVisitor;

import java.util.EnumMap;
import java.util.Map;

/**
 * Visit a Receptor SnecmaObject to make a R23 report.
 */
public class R23ReceptorVisitor implements IReceptorVisitor<Map<R23VisitorKeys, String>> {
    private static final long serialVersionUID = 390235455677826754L;

    @Override
    public Map<R23VisitorKeys, String> visitReceptor(final ProductRevision aProductRev) {
        return getReceptorProperties(aProductRev);
    }

    @Override
    public Map<R23VisitorKeys, String> visitReceptor(final GenericRevision aGenericRev) {
        return getReceptorProperties(aGenericRev);
    }

    @Override
    public Map<R23VisitorKeys, String> visitReceptor(final SuperModelRevision aSuperModelRev) {
        return getReceptorProperties(aSuperModelRev);
    }

    @Override
    public Map<R23VisitorKeys, String> visitReceptor(final GenericAssembRevision aGenericAssembRev) {
        return getReceptorProperties(aGenericAssembRev);
    }

    @Override
    public Map<R23VisitorKeys, String> visitReceptor(final AlternateRevision anAlternateRev) {
        return getReceptorProperties(anAlternateRev);
    }

    @Override
    public Map<R23VisitorKeys, String> visitReceptor(final DETRevision aDetRev) {
        return getReceptorProperties(aDetRev);
    }

    @Override
    public Map<R23VisitorKeys, String> visitReceptor(final PartAeroRevision aPartAeroRev) {
        return getReceptorProperties(aPartAeroRev);
    }

    @Override
    public Map<R23VisitorKeys, String> visitReceptor(final PartNoAeroRevision aPartNoAeroRev) {
        return getReceptorProperties(aPartNoAeroRev);
    }

    @Override
    public Map<R23VisitorKeys, String> visitReceptor(final PartAssembRevision aPartAssembRev) {
        return getReceptorProperties(aPartAssembRev);
    }

    @Override
    public Map<R23VisitorKeys, String> visitReceptor(final PartMatRevision aPartMatRev) {
        return getReceptorProperties(aPartMatRev);
    }

    @Override
    public Map<R23VisitorKeys, String> visitReceptor(final StandardRevision aStandardRev) {
        return getReceptorProperties(aStandardRev);
    }

    @Override
    public Map<R23VisitorKeys, String> visitReceptor(final RFGenericRevision aRfGenericRev) {
        // No use in R23 report
        return new EnumMap<>(R23VisitorKeys.class);
    }

    @Override
    public Map<R23VisitorKeys, String> visitReceptor(final RFPartAssembRevision aRfPartAssembRev) {
        // No use in R23 report
        return new EnumMap<>(R23VisitorKeys.class);
    }

    @Override
    public Map<R23VisitorKeys, String> visitReceptor(final RFPartRevision aRfPartRev) {
        // No use in R23 report
        return new EnumMap<>(R23VisitorKeys.class);
    }

    @Override
    public Map<R23VisitorKeys, String> visitReceptor(final RFAdminRevision aRfAdminRev) {
        // No use in R23 report
        return new EnumMap<>(R23VisitorKeys.class);
    }

    @Override
    public Map<R23VisitorKeys, String> visitReceptor(final RFAdminARevision aRfAdminARev) {
        // No use in R23 report
        return new EnumMap<>(R23VisitorKeys.class);
    }

    @Override
    public Map<R23VisitorKeys, String> visitReceptor(final RFAdminAPRevision aRfAdminAPRev) {
        // No use in R23 report
        return new EnumMap<>(R23VisitorKeys.class);
    }

    @Override
    public Map<R23VisitorKeys, String> visitReceptor(final RFAdminAGRevision aRfAdminAGRev) {
        // No use in R23 report
        return new EnumMap<>(R23VisitorKeys.class);
    }

    /**
     * Get the Receptor properties.
     */
    private Map<R23VisitorKeys, String> getReceptorProperties(final ISnecmaObject iSnecmaObject) {
        Map<R23VisitorKeys, String> theMap = new EnumMap<>(R23VisitorKeys.class);
        theMap.put(R23VisitorKeys.IDENTIFIANT_RECEPTEUR, iSnecmaObject.getItemId());
        theMap.put(R23VisitorKeys.NOM_RECEPTEUR, iSnecmaObject.getName());
        theMap.put(R23VisitorKeys.REVISION_RECEPTEUR, iSnecmaObject.getRevisionId());
        return theMap;
    }

    @Override
    public Map<R23VisitorKeys, String> visitReceptor(final MockupRevision aMockupRev) {
        // This object is not use in this report
        return null;
    }

    @Override
    public Map<R23VisitorKeys, String> visitReceptor(final DescriptifRevision aDescriptifRev) {
        // This object is not use in this report
        return null;
    }

    @Override
    public Map<R23VisitorKeys, String> emptyRf() {
        return new EnumMap<>(R23VisitorKeys.class);
    }
}
