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

import com.capgemini.reports.bomlineholder.processor.AltOrDetBehaviour;
import com.capgemini.reports.definition.r23report.visitors.R23VisitorKeys;
import com.capgemini.reports.snecmaobjects.part.AlternateRevision;
import com.capgemini.reports.snecmaobjects.part.DETRevision;

import java.util.Map;

/**
 * This class visits Parts that are below an {@link AlternateRevision} or a {@link DETRevision}.<br>
 * It puts "Oui" in the ALTERNATIVE field of a map.
 */
public class R23AltOrDetBehaviour implements AltOrDetBehaviour<R23VisitorKeys, String> {
  private static final long serialVersionUID = -7332694328622575681L;

  private static final String OUI = "Oui";
  private static final String EMPTY_STRING = "";

  @Override
  public boolean shouldVisitPartsInPseudoFolder() {
    return true;
  }

  @Override
  public boolean shouldVisitPartsBelowAlt() {
    return true;
  }

  @Override
  public void treatPartsInPseudoFolder(final Map<R23VisitorKeys, String> map) {
    treatAnyPartBelowThisAltOrDet(map);
  }

  @Override
  public void treatAlternateOrDETAsReceptor(final Map<R23VisitorKeys, String> map) {
    treatAnyPartBelowThisAltOrDet(map);
  }

  private void treatAnyPartBelowThisAltOrDet(final Map<R23VisitorKeys, String> map) {
    // Empty fields
    map.put(R23VisitorKeys.REPERE_FONCTIONNEL, EMPTY_STRING);
    map.put(R23VisitorKeys.IDENTIFIANT_REPERE_FONCTIONNEL, EMPTY_STRING);
    map.put(R23VisitorKeys.REVISION_REPERE_FONCTIONNEL, EMPTY_STRING);
    map.put(R23VisitorKeys.MAQUETTE, EMPTY_STRING);
    map.put(R23VisitorKeys.UIN, EMPTY_STRING);
    map.put(R23VisitorKeys.EQUIVALENT_SNSSIN, EMPTY_STRING);
    map.put(R23VisitorKeys.RESPONSABLE_REPERE, EMPTY_STRING);
    map.put(R23VisitorKeys.TRANSFERT_LIEN_LOGISTIQUE, EMPTY_STRING);
    map.put(R23VisitorKeys.TRANSFERT_LIEN_MONTAGE, EMPTY_STRING);
    map.put(R23VisitorKeys.SUIVI_MONTAGE, EMPTY_STRING);
    map.put(R23VisitorKeys.IDENTIFIANT_RF_ADMIN, EMPTY_STRING);
    map.put(R23VisitorKeys.REVISION_RF_ADMIN, EMPTY_STRING);
    map.put(R23VisitorKeys.IDENTIFIANT_RF_ADMIN_AP, EMPTY_STRING);
    map.put(R23VisitorKeys.REVISION_RF_ADMIN_AP, EMPTY_STRING);
    map.put(R23VisitorKeys.FRONTIERE_AVION, EMPTY_STRING);
    map.put(R23VisitorKeys.FRONTIERE_COOPERANT, EMPTY_STRING);
    map.put(R23VisitorKeys.GEOMETRIE_PIECE_RIGIDE, EMPTY_STRING);
    map.put(R23VisitorKeys.GEOMETRIE_SIMPLIFIE_RIGIDE, EMPTY_STRING);
    map.put(R23VisitorKeys.ENVELOPPE_DE_CINEMATIQUE, EMPTY_STRING);
    map.put(R23VisitorKeys.ENVELOPPE_DE_MAINTENANCE, EMPTY_STRING);
    map.put(R23VisitorKeys.ENVELOPPE_DE_MONTAGE_DEMONTAGE, EMPTY_STRING);
    map.put(R23VisitorKeys.TRACE_AXIALE, EMPTY_STRING);
    map.put(R23VisitorKeys.INTERFACE, EMPTY_STRING);
    map.put(R23VisitorKeys.PROJECT_MOTEUR, EMPTY_STRING);
    map.put(R23VisitorKeys.MAQUETTE_ECHANGEABLE, EMPTY_STRING);
    map.put(R23VisitorKeys.WORKPACKAGE, EMPTY_STRING);
    map.put(R23VisitorKeys.ALT, EMPTY_STRING);
    map.put(R23VisitorKeys.SB, EMPTY_STRING);
    map.put(R23VisitorKeys.QUANTITE_CUMULEE, EMPTY_STRING);
    map.put(R23VisitorKeys.PANACHE, EMPTY_STRING);
    map.put(R23VisitorKeys.QUANTITE, EMPTY_STRING);

    // Mention that these parts are alternatives to each other
    map.put(R23VisitorKeys.ALTERNATIVE, OUI);
  }
}
