package de.dhbwstuttgart.target.tree.expression;

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

import java.util.List;

public record TargetSwitch(TargetExpression expr, List<Case> cases, Case default_, TargetType type, boolean isExpression) implements TargetExpression {

    public TargetSwitch(TargetExpression expr, List<Case> cases, Case default_) {
        this(expr, cases, default_, null, false);
    }

    public TargetSwitch(TargetExpression expr, List<Case> cases, Case default_, TargetType type) {
        this(expr, cases, default_, type, true);
    }

    public TargetSwitch(TargetExpression expr, List<Case> cases, Case default_, boolean isExpression) {
        this(expr, cases, default_, null, isExpression);
    }

    public record Case(List<TargetExpression> labels, TargetBlock body, boolean isSingleExpression) {
        public Case(List<TargetExpression> labels, TargetBlock body) {
            this(labels, body, false);
        }
        public Case(TargetBlock body, boolean isSingleExpression) {
            this(List.of(), body, isSingleExpression);
        }
    }

}
