/*-
 * #%L
 * JSQLParser library
 * %%
 * Copyright (C) 2004 - 2023 JSQLParser
 * %%
 * Dual licensed under GNU LGPL 2.1 or Apache License 2.0
 * #L%
 */
package net.sf.jsqlparser.statement.delete;

import net.sf.jsqlparser.expression.Alias;
import net.sf.jsqlparser.statement.ParenthesedStatement;
import net.sf.jsqlparser.statement.StatementVisitor;

public class ParenthesedDelete extends Delete implements ParenthesedStatement {

    Alias alias;
    Delete delete;

    @Override
    public Alias getAlias() {
        return alias;
    }

    @Override
    public void setAlias(Alias alias) {
        this.alias = alias;
    }

    public ParenthesedDelete withAlias(Alias alias) {
        this.setAlias(alias);
        return this;
    }

    public Delete getDelete() {
        return delete;
    }

    public void setDelete(Delete delete) {
        this.delete = delete;
    }

    public ParenthesedDelete withDelete(Delete delete) {
        setDelete(delete);
        return this;
    }

    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("(").append(delete).append(")");
        if (alias != null) {
            builder.append(alias);
        }
        return builder.toString();
    }

    @Override
    public <T, S> T accept(StatementVisitor<T> statementVisitor, S context) {
        return statementVisitor.visit(this, context);
    }
}
