package com.chenyang.druid.sql.dialect.mariadb.ast.statement;

import com.chenyang.druid.sql.ast.SQLName;
import com.chenyang.druid.sql.ast.statement.SQLAlterStatement;
import com.chenyang.druid.sql.dialect.mariadb.ast.MariadbObjectImpl;
import com.chenyang.druid.sql.dialect.mariadb.visitor.MariadbASTVisitor;
import java.util.ArrayList;
import java.util.List;

public class MariadbRenameTableStatement extends MariadbStatementImpl implements SQLAlterStatement {
   private List<Item> items = new ArrayList(2);

   public List<Item> getItems() {
      return this.items;
   }

   public void addItem(Item item) {
      if (item != null) {
         item.setParent(this);
      }

      this.items.add(item);
   }

   public void accept0(MariadbASTVisitor visitor) {
      if (visitor.visit(this)) {
         this.acceptChild(visitor, this.items);
      }

      visitor.endVisit(this);
   }

   public static class Item extends MariadbObjectImpl {
      private SQLName name;
      private SQLName to;

      public SQLName getName() {
         return this.name;
      }

      public void setName(SQLName name) {
         this.name = name;
      }

      public SQLName getTo() {
         return this.to;
      }

      public void setTo(SQLName to) {
         this.to = to;
      }

      public void accept0(MariadbASTVisitor visitor) {
         if (visitor.visit(this)) {
            this.acceptChild(visitor, this.name);
            this.acceptChild(visitor, this.to);
         }

         visitor.endVisit(this);
      }
   }
}
