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

import com.capgemini.reports.definition.r03report.visitors.R03VisitorKeys;
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 R03 report.
 */
public class R03ReceptorVisitor implements IReceptorVisitor<Map<R03VisitorKeys, String>> {

  private static final long serialVersionUID = 8706801275271305065L;

  @Override
  public Map<R03VisitorKeys, String> visitReceptor(final ProductRevision aProductRev) {
    return new EnumMap<>(R03VisitorKeys.class);
  }

  @Override
  public Map<R03VisitorKeys, String> visitReceptor(final GenericRevision aGenericRev) {
    return new EnumMap<>(R03VisitorKeys.class);
  }

  @Override
  public Map<R03VisitorKeys, String> visitReceptor(final GenericAssembRevision aGenericAssembRev) {
    return new EnumMap<>(R03VisitorKeys.class);
  }

  @Override
  public Map<R03VisitorKeys, String> visitReceptor(SuperModelRevision aSuperModelRev) {
    return null;
  }

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

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

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

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

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

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

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

  @Override
  public Map<R03VisitorKeys, String> visitReceptor(final RFGenericRevision aRfGenericRev) {
    return new EnumMap<>(R03VisitorKeys.class);
  }

  @Override
  public Map<R03VisitorKeys, String> visitReceptor(final RFPartAssembRevision aRfPartAssembRev) {
    return new EnumMap<>(R03VisitorKeys.class);
  }

  @Override
  public Map<R03VisitorKeys, String> visitReceptor(final RFPartRevision aRfPartRev) {
    return new EnumMap<>(R03VisitorKeys.class);
  }

  @Override
  public Map<R03VisitorKeys, String> visitReceptor(final RFAdminRevision aRfAdminRev) {
    return new EnumMap<>(R03VisitorKeys.class);
  }

  @Override
  public Map<R03VisitorKeys, String> visitReceptor(final RFAdminARevision aRfAdminARev) {
    return new EnumMap<>(R03VisitorKeys.class);
  }

  @Override
  public Map<R03VisitorKeys, String> visitReceptor(final RFAdminAPRevision aRfAdminAPRev) {
    return new EnumMap<>(R03VisitorKeys.class);
  }

  @Override
  public Map<R03VisitorKeys, String> visitReceptor(final RFAdminAGRevision aRfAdminAGRev) {
    return new EnumMap<>(R03VisitorKeys.class);
  }

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

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

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

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