package p.studio.compiler.models;

import p.studio.compiler.source.identifiers.ProjectId;
import p.studio.compiler.source.tables.ProjectTableReader;
import p.studio.utilities.structures.ReadOnlyList;

public record WorkspaceGraph(
        ProjectTableReader projectTable,
        ReadOnlyList<ReadOnlyList<ProjectId>> dependenciesByProjectId) {

    public ProjectDescriptor projectDescriptor(final ProjectId projectId) {
        return projectTable.get(projectId);
    }

    public ReadOnlyList<ProjectId> dependencies(final ProjectId projectId) {
        return dependenciesByProjectId.get(projectId.getIndex());
    }
}
