package p.studio.compiler.pbs.semantics;

import p.studio.compiler.pbs.semantics.PbsFlowSemanticSupport.Model;
import p.studio.compiler.pbs.semantics.PbsFlowSemanticSupport.Scope;
import p.studio.compiler.pbs.semantics.PbsFlowSemanticSupport.TypeView;
import p.studio.compiler.source.diagnostics.DiagnosticSink;

final class PbsFlowBodyContext {
    private final Scope scope;
    private final TypeView returnType;
    private final String resultErrorName;
    private final TypeView receiverType;
    private final Model model;
    private final DiagnosticSink diagnostics;

    PbsFlowBodyContext(
            final Scope scope,
            final TypeView returnType,
            final String resultErrorName,
            final TypeView receiverType,
            final Model model,
            final DiagnosticSink diagnostics) {
        this.scope = scope;
        this.returnType = returnType;
        this.resultErrorName = resultErrorName;
        this.receiverType = receiverType;
        this.model = model;
        this.diagnostics = diagnostics;
    }

    Scope scope() {
        return scope;
    }

    TypeView returnType() {
        return returnType;
    }

    String resultErrorName() {
        return resultErrorName;
    }

    TypeView receiverType() {
        return receiverType;
    }

    Model model() {
        return model;
    }

    DiagnosticSink diagnostics() {
        return diagnostics;
    }

    PbsFlowBodyContext withScope(final Scope nextScope) {
        return new PbsFlowBodyContext(
                nextScope,
                returnType,
                resultErrorName,
                receiverType,
                model,
                diagnostics);
    }
}
