package com.alibaba.druid.sql.dialect.db2.ast.stmt;

import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.SQLName;
import com.alibaba.druid.sql.ast.statement.SQLAlterDatabaseStatement;
import com.alibaba.druid.sql.ast.statement.SQLAlterStatement;
import com.alibaba.druid.sql.dialect.db2.visitor.DB2ASTVisitor;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
import java.util.ArrayList;
import java.util.List;

public class DB2AlterDatabaseStatement extends SQLAlterDatabaseStatement implements DB2SQLStatement, SQLAlterStatement {
   private SQLName newName;
   private SQLExpr newOwner;
   private boolean set;
   private boolean defaultSchema;
   private SQLExpr defaultSchemaName;
   private boolean defaultCharacterSetLatin9;
   private boolean collectHistory;
   private SQLExpr collectHistoryType;
   private boolean dataVersionRetentionTime;
   private SQLExpr dataVersionRetentionTimeNum;
   private boolean nocascade;
   private boolean groomBackupset;
   private SQLExpr groomBackupsetNum;
   private SetType type;
   private List<SQLExpr> values;

   public boolean isDefaultSchema() {
      return this.defaultSchema;
   }

   public void setDefaultSchema(boolean defaultSchema) {
      this.defaultSchema = defaultSchema;
   }

   public SQLExpr getDefaultSchemaName() {
      return this.defaultSchemaName;
   }

   public void setDefaultSchemaName(SQLExpr defaultSchemaName) {
      this.defaultSchemaName = defaultSchemaName;
   }

   public boolean isDefaultCharacterSetLatin9() {
      return this.defaultCharacterSetLatin9;
   }

   public void setDefaultCharacterSetLatin9(boolean defaultCharacterSetLatin9) {
      this.defaultCharacterSetLatin9 = defaultCharacterSetLatin9;
   }

   public boolean isCollectHistory() {
      return this.collectHistory;
   }

   public void setCollectHistory(boolean collectHistory) {
      this.collectHistory = collectHistory;
   }

   public SQLExpr getCollectHistoryType() {
      return this.collectHistoryType;
   }

   public void setCollectHistoryType(SQLExpr collectHistoryType) {
      this.collectHistoryType = collectHistoryType;
   }

   public boolean isDataVersionRetentionTime() {
      return this.dataVersionRetentionTime;
   }

   public void setDataVersionRetentionTime(boolean dataVersionRetentionTime) {
      this.dataVersionRetentionTime = dataVersionRetentionTime;
   }

   public SQLExpr getDataVersionRetentionTimeNum() {
      return this.dataVersionRetentionTimeNum;
   }

   public void setDataVersionRetentionTimeNum(SQLExpr dataVersionRetentionTimeNum) {
      this.dataVersionRetentionTimeNum = dataVersionRetentionTimeNum;
   }

   public boolean isNocascade() {
      return this.nocascade;
   }

   public void setNocascade(boolean nocascade) {
      this.nocascade = nocascade;
   }

   public boolean isGroomBackupset() {
      return this.groomBackupset;
   }

   public void setGroomBackupset(boolean groomBackupset) {
      this.groomBackupset = groomBackupset;
   }

   public SQLExpr getGroomBackupsetNum() {
      return this.groomBackupsetNum;
   }

   public void setGroomBackupsetNum(SQLExpr groomBackupsetNum) {
      this.groomBackupsetNum = groomBackupsetNum;
   }

   public DB2AlterDatabaseStatement() {
      this.type = SetType.None;
      this.values = new ArrayList();
      this.dbType = DbType.db2;
   }

   public SQLName getNewName() {
      return this.newName;
   }

   public void setNewName(SQLName newName) {
      this.newName = newName;
      if (newName != null) {
         newName.setParent(this);
      }

   }

   public SQLExpr getNewOwner() {
      return this.newOwner;
   }

   public void setNewOwner(SQLExpr newOwner) {
      this.newOwner = newOwner;
      if (newOwner != null) {
         newOwner.setParent(this);
      }

   }

   public List<SQLExpr> getValues() {
      return this.values;
   }

   public void setValues(List<SQLExpr> values) {
      this.values = values;
   }

   public void addValue(SQLExpr value) {
      this.values.add(value);
      value.setParent(this);
   }

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

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

   public boolean isSet() {
      return this.set;
   }

   public void setSet(boolean set) {
      this.set = set;
   }

   public void accept0(SQLASTVisitor visitor) {
      this.accept0((DB2ASTVisitor)visitor);
   }

   public void accept0(DB2ASTVisitor visitor) {
      if (visitor.visit(this)) {
         this.acceptChild(visitor, this.getName());
         this.acceptChild(visitor, this.newName);
         this.acceptChild(visitor, this.newOwner);
         this.acceptChild(visitor, this.values);
      }

      visitor.endVisit(this);
   }

   public DB2AlterDatabaseStatement clone() {
      DB2AlterDatabaseStatement c = new DB2AlterDatabaseStatement();
      c.setName(this.getName().clone());
      if (this.newName != null) {
         c.newName = this.newName.clone();
      }

      if (this.newOwner != null) {
         c.newOwner = this.newOwner.clone();
      }

      if (this.values != null) {
         for(SQLExpr value : this.values) {
            c.values.add(value.clone());
         }
      }

      c.type = this.type;
      return c;
   }

   public static enum SetType {
      None,
      Reset,
      Set;
   }
}
