package com.alibaba.druid.sql.dialect.greenplum.ast.stmt.alterTable;

import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.statement.SQLAlterTableItem;
import com.alibaba.druid.sql.dialect.greenplum.ast.GPSQLObjectImpl;
import com.alibaba.druid.sql.dialect.greenplum.visitor.GPASTVisitor;

public class GPAlterTableDropColumn extends GPSQLObjectImpl implements SQLAlterTableItem {
   private SQLExpr columnName;
   private DropColumType type;
   private boolean ifExists;

   public void accept0(GPASTVisitor visitor) {
      if (visitor.visit(this)) {
         this.acceptChild(visitor, this.columnName);
      }

      visitor.endVisit(this);
   }

   public boolean isIfExists() {
      return this.ifExists;
   }

   public void setIfExists(boolean ifExists) {
      this.ifExists = ifExists;
   }

   public DropColumType getType() {
      return this.type;
   }

   public void setType(DropColumType type) {
      this.type = type;
   }

   public SQLExpr getColumnName() {
      return this.columnName;
   }

   public void setColumnName(SQLExpr columnName) {
      columnName.setParent(this);
      this.columnName = columnName;
   }

   public GPAlterTableDropColumn clone() {
      GPAlterTableDropColumn c = new GPAlterTableDropColumn();
      c.setColumnName(this.columnName.clone());
      c.ifExists = this.ifExists;
      c.type = this.type;
      return c;
   }

   public static enum DropColumType {
      restrict,
      cascade;
   }
}
