package de.dhbwstuttgart.target.tree.expression;

import de.dhbwstuttgart.target.tree.type.TargetType;

import java.util.List;

public record TargetComplexPattern(TargetType ctor, TargetType type, String name, List<TargetPattern> subPatterns) implements TargetPattern {
    @Override
    public TargetComplexPattern withType(TargetType type) {
        return new TargetComplexPattern(ctor, type, name, subPatterns);
    }

    @Override
    public TargetComplexPattern withName(String name) {
        return new TargetComplexPattern(ctor, type, name, subPatterns);
    }

    @Override
    public String toString() {
        return type + "(" + String.join(", ", subPatterns.stream().map(Object::toString).toList()) + ") " + name;
    }
}
