001package gudusoft.gsqlparser.resolver2.binding;
002
003/**
004 * Frozen v1 binding diagnostic codes (plan §5.4).
005 *
006 * <p>Codes are a stable public contract: once shipped, names do not change
007 * without a compatibility note. Default severities are documented per
008 * {@link #defaultSeverity()}; consumers can override per-code via
009 * {@code TSQLResolverConfig.setBindingSeverityFor(...)}.</p>
010 *
011 * <p>Message text is explicitly NOT part of the stability contract — tests
012 * should assert on stable substrings, not exact wording.</p>
013 */
014public enum BindingDiagnosticCode {
015
016    UNKNOWN_TABLE(BindingDiagnosticSeverity.ERROR),
017    UNKNOWN_COLUMN(BindingDiagnosticSeverity.ERROR),
018    AMBIGUOUS_COLUMN(BindingDiagnosticSeverity.ERROR),
019    UNKNOWN_ALIAS(BindingDiagnosticSeverity.ERROR),
020    INVALID_COLUMN_QUALIFIER(BindingDiagnosticSeverity.ERROR),
021    INVALID_STAR_QUALIFIER(BindingDiagnosticSeverity.ERROR),
022    UNBOUND_COLUMN_REFERENCE(BindingDiagnosticSeverity.ERROR),
023    CTE_OUTPUT_COLUMN_MISSING(BindingDiagnosticSeverity.ERROR),
024    SUBQUERY_OUTPUT_COLUMN_MISSING(BindingDiagnosticSeverity.ERROR),
025    SET_OPERATION_ARITY_MISMATCH(BindingDiagnosticSeverity.ERROR),
026    USING_COLUMN_NOT_COMMON(BindingDiagnosticSeverity.ERROR),
027    INTERNAL_BINDING_ERROR(BindingDiagnosticSeverity.ERROR),
028    CATALOG_METADATA_UNAVAILABLE(BindingDiagnosticSeverity.WARNING),
029    UNSUPPORTED_BINDING_SCOPE(BindingDiagnosticSeverity.WARNING);
030
031    private final BindingDiagnosticSeverity defaultSeverity;
032
033    BindingDiagnosticCode(BindingDiagnosticSeverity defaultSeverity) {
034        this.defaultSeverity = defaultSeverity;
035    }
036
037    public BindingDiagnosticSeverity defaultSeverity() {
038        return defaultSeverity;
039    }
040}