package com.capgemini.reports.snecmaobjects.part;

import com.capgemini.framework.teamcenter.authent.TcSession;
import com.capgemini.framework.teamcenter.object.types.SnecmaObjectTypes;
import com.capgemini.reports.snecmaobjects.visitor.IComponentVisitor;
import com.capgemini.reports.snecmaobjects.visitor.IReceptorVisitor;
import com.teamcenter.soa.client.model.strong.ItemRevision;

import static com.capgemini.framework.teamcenter.object.SnecmaObjectProperties.*;

/**
 * Class representing a PartAeroRevision.
 */
public class PartAeroRevision extends AbstractPart {
    private static final long serialVersionUID = -3486163177030124825L;

    public PartAeroRevision(final TcSession session, final ItemRevision itemRevision) {
        super(session, itemRevision);
    }

    public String getTypeAero1() {
        return getMasterFormRev().getPropertyObject(PV_TYPE_PART_AERO_1).getDisplayableValue();
    }

    public String getTypeAero2() {
        return getMasterFormRev().getPropertyObject(PV_TYPE_PART_AERO_2).getDisplayableValue();
    }

    public String getTypeAero3() {
        return getMasterFormRev().getPropertyObject(PV_TYPE_PART_AERO_3).getDisplayableValue();
    }

    public String getObturation() {
        return getMasterFormRev().getPropertyObject(PV_OBTURATION).getStringValue();
    }

    public String[] getLstFournisseurs() {
        return itemRevision.getPropertyObject(PV_FOURNISSEURS).getStringArrayValue();
    }

    @Override
    public <T> T accept(final IReceptorVisitor<T> aReceptorVisitor) {
        return aReceptorVisitor.visitReceptor(this);
    }

    @Override
    public <T> T accept(final IComponentVisitor<T> aComponentVisitor) {
        return aComponentVisitor.visitComponent(this);
    }

    @Override
    public boolean isSuperModel() {
        return false;
    }

    @Override
    public String toString() {
        return SnecmaObjectTypes.PART_AERO_REVISION + " " + this.getItemId();
    }
}
