package p.studio.compiler.source.diagnostics;

import p.studio.compiler.source.Span;

import java.util.List;
import java.util.Map;

public final class Diagnostics {
    private Diagnostics() {
    }

    public static DiagnosticSink error(
            final DiagnosticSink sink,
            final String code,
            final String message,
            final Span span) {
        return sink.error(code, code, Map.of(), message, span);
    }

    public static DiagnosticSink error(
            final DiagnosticSink sink,
            final String code,
            final String message,
            final Span span,
            final List<RelatedSpan> related) {
        return sink.error(code, code, Map.of(), message, span, related);
    }

    public static DiagnosticSink warning(
            final DiagnosticSink sink,
            final String code,
            final String message,
            final Span span) {
        return sink.warning(code, code, Map.of(), message, span);
    }

    public static DiagnosticSink report(
            final DiagnosticSink sink,
            final Severity severity,
            final String code,
            final String message,
            final Span span,
            final List<RelatedSpan> related) {
        return sink.report(
                severity,
                code,
                DiagnosticPhase.fromCode(code),
                code,
                Map.of(),
                message,
                span,
                related);
    }
}
