001package gudusoft.gsqlparser.ir.semantic;
002
003import java.util.ArrayList;
004import java.util.Collections;
005import java.util.List;
006
007/**
008 * Top-level Semantic IR container. Holds one {@link StatementGraph} per
009 * SQL statement (CTE bodies are emitted as their own statements before the
010 * outer one), plus a flat list of {@link LineageEdge}s spanning statements.
011 */
012public final class SemanticProgram {
013
014    private final List<StatementGraph> statements;
015    private final List<LineageEdge> lineage;
016
017    public SemanticProgram(List<StatementGraph> statements, List<LineageEdge> lineage) {
018        if (statements == null) {
019            throw new IllegalArgumentException("statements must not be null");
020        }
021        if (lineage == null) {
022            throw new IllegalArgumentException("lineage must not be null");
023        }
024        this.statements = Collections.unmodifiableList(new ArrayList<>(statements));
025        this.lineage = Collections.unmodifiableList(new ArrayList<>(lineage));
026    }
027
028    public List<StatementGraph> getStatements() {
029        return statements;
030    }
031
032    public List<LineageEdge> getLineage() {
033        return lineage;
034    }
035}