package de.dhbwstuttgart.target.tree.type;

import java.util.List;

public sealed interface TargetSpecializedType extends TargetType permits TargetFunNType, TargetRefType {
    List<TargetType> params();

    @Override
    default String toSignature() {
        String ret = "L" + getInternalName();
        ret += signatureParameters(params());
        ret += ";";
        return ret;
    }

    static String signatureParameters(List<TargetType> params) {
        var ret = "";
        if (!params.isEmpty()) {
            ret += "<";
            for (var param : params) {
                ret += param.toSignature();
            }
            ret += ">";
        }
        return ret;
    }

    @Override
    default String toDescriptor() {
        return "L" + getInternalName() + ";";
    }
}
