package com.capgemini.reports.snecmaobjects.generic;

import com.capgemini.framework.teamcenter.authent.TcSession;
import com.teamcenter.soa.client.model.strong.Item;

public class AbstractGeneric implements Comparable<AbstractGeneric> {
    private final TcSession session;
    private final Item item;

    public AbstractGeneric(final TcSession session, final Item item) {
        this.session = session;
        this.item = item;
    }

    public String getItemId() {
        return item.get_item_id();
    }


    public String getName() {
        return item.get_object_name();
    }

    public String getType() {
        return item.getTypeObject().getName();
    }

    @Override
    public int compareTo(final AbstractGeneric other) {
        return this.getItemId().compareTo(other.getItemId());
    }

    @Override
    public boolean equals(final Object obj) {
        return this == obj || obj instanceof AbstractGeneric && item.equals(((AbstractGeneric) obj).item);
    }

    @Override
    public int hashCode() {
        return item.hashCode();
    }
}
