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

import com.capgemini.reports.definition.r01report.visitors.R01VisitorKeys;
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 R01 report.
 */
public class R01ReceptorVisitor implements IReceptorVisitor<Map<R01VisitorKeys, String>> {
  private static final long serialVersionUID = -3978586236500021891L;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  @Override
  public Map<R01VisitorKeys, String> emptyRf() {
    Map<R01VisitorKeys, String> theMap = new EnumMap<>(R01VisitorKeys.class);
    theMap.put(R01VisitorKeys.REPERE_FONCTIONNEL, "");
    theMap.put(R01VisitorKeys.REVISION_REPERE_FONCTIONNEL, "");
    theMap.put(R01VisitorKeys.IDENTIFIANT_REPERE_FONCTIONNEL, "");
    theMap.put(R01VisitorKeys.MAQUETTE, "");
    theMap.put(R01VisitorKeys.TRANSFERT_LIEN_LOGISTIQUE, "");
    theMap.put(R01VisitorKeys.TRANSFERT_LIEN_MONTAGE, "");
    theMap.put(R01VisitorKeys.EQUIVALENT_SNSSIN, "");
    theMap.put(R01VisitorKeys.RESPONSABLE_REPERE, "");
    theMap.put(R01VisitorKeys.SUIVI_MONTAGE, "");
    return theMap;
  }
}
