001package gudusoft.gsqlparser.catalog.runtime;
002
003import java.util.Objects;
004
005/**
006 * Stable identity of a catalog object across {@link CatalogSnapshot} instances.
007 *
008 * <p>Plan §7.2. The {@code value} is opaque to consumers — providers choose what they
009 * embed (e.g., a Glue table ARN, an Iceberg snapshot id, or just the normalized qualified
010 * name for the in-memory provider). Equality is by string value.</p>
011 */
012public final class CatalogObjectId {
013
014    private final String value;
015
016    private CatalogObjectId(String value) {
017        if (value == null || value.isEmpty()) {
018            throw new IllegalArgumentException("CatalogObjectId.value must be non-empty");
019        }
020        this.value = value;
021    }
022
023    public static CatalogObjectId of(String value) {
024        return new CatalogObjectId(value);
025    }
026
027    public String value() {
028        return value;
029    }
030
031    @Override
032    public boolean equals(Object o) {
033        if (this == o) return true;
034        if (!(o instanceof CatalogObjectId)) return false;
035        return value.equals(((CatalogObjectId) o).value);
036    }
037
038    @Override
039    public int hashCode() {
040        return Objects.hash(value);
041    }
042
043    @Override
044    public String toString() {
045        return "CatalogObjectId[" + value + "]";
046    }
047}