package p.studio.compiler.pbs.stdlib;

import p.studio.utilities.structures.ReadOnlyList;

import java.util.Objects;

public record StdlibModuleSource(
        String project,
        ReadOnlyList<String> pathSegments,
        ReadOnlyList<SourceFile> sourceFiles,
        String barrelSource) {

    public StdlibModuleSource {
        project = Objects.requireNonNull(project, "project");
        pathSegments = pathSegments == null ? ReadOnlyList.empty() : pathSegments;
        sourceFiles = sourceFiles == null ? ReadOnlyList.empty() : sourceFiles;
        barrelSource = Objects.requireNonNull(barrelSource, "barrelSource");
    }

    public record SourceFile(
            String logicalPath,
            String source) {
        public SourceFile {
            logicalPath = Objects.requireNonNull(logicalPath, "logicalPath");
            source = Objects.requireNonNull(source, "source");
        }
    }
}

