package lc.mecha.lang;

import java.io.Serializable;
import java.util.Objects;
import java.util.UUID;

public class IdentifiedObjectBase implements IdentifiedObject, Serializable {
    private final UUID id;

    public IdentifiedObjectBase(UUID id) {
        this.id = id;
    }

    @Override
    public UUID getId() {
        return id;
    }

    @Override
    public String toString() {
        return "IdentifiedObjectBase{" +
                "id=" + id +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        IdentifiedObjectBase that = (IdentifiedObjectBase) o;
        return Objects.equals(id, that.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}
