package com.chenyang.druid.sql.dialect.postgresql.ast.stmt;

import com.chenyang.druid.DbType;
import com.chenyang.druid.sql.ast.SQLStatement;
import com.chenyang.druid.sql.ast.SQLStatementImpl;
import com.chenyang.druid.sql.ast.expr.SQLIdentifierExpr;
import com.chenyang.druid.sql.ast.statement.SQLCreateStatement;
import com.chenyang.druid.sql.dialect.postgresql.visitor.PGASTVisitor;
import com.chenyang.druid.sql.visitor.SQLASTVisitor;
import java.util.ArrayList;
import java.util.List;

public class PGCreateSchemaStatement extends SQLStatementImpl implements PGSQLStatement, SQLCreateStatement {
   private SQLIdentifierExpr schemaName;
   private SQLIdentifierExpr userName;
   private boolean ifNotExists;
   private boolean authorization;
   private List<SQLStatement> elements = new ArrayList();

   public PGCreateSchemaStatement() {
      this.dbType = DbType.postgresql;
   }

   public SQLIdentifierExpr getSchemaName() {
      return this.schemaName;
   }

   public void addElement(SQLStatement e) {
      e.setParent(this);
      this.elements.add(e);
   }

   public List<SQLStatement> getElements() {
      return this.elements;
   }

   public void setElements(List<SQLStatement> elements) {
      this.elements = elements;
   }

   public void setSchemaName(SQLIdentifierExpr schemaName) {
      this.schemaName = schemaName;
      schemaName.setParent(this);
   }

   public SQLIdentifierExpr getUserName() {
      return this.userName;
   }

   public void setUserName(SQLIdentifierExpr userName) {
      this.userName = userName;
      userName.setParent(this);
   }

   public boolean isIfNotExists() {
      return this.ifNotExists;
   }

   public void setIfNotExists(boolean ifNotExists) {
      this.ifNotExists = ifNotExists;
   }

   public boolean isAuthorization() {
      return this.authorization;
   }

   public void setAuthorization(boolean authorization) {
      this.authorization = authorization;
   }

   protected void accept0(SQLASTVisitor visitor) {
      this.accept0((PGASTVisitor)visitor);
   }

   public void accept0(PGASTVisitor visitor) {
      if (visitor.visit(this)) {
         this.acceptChild(visitor, this.schemaName);
         this.acceptChild(visitor, this.userName);
         this.acceptChild(visitor, this.elements);
      }

      visitor.endVisit(this);
   }
}
