package com.alibaba.druid.sql.dialect.mysql.ast.statement;

import com.alibaba.druid.sql.ast.SQLCommentHint;
import com.alibaba.druid.sql.ast.statement.SQLExprTableSource;
import com.alibaba.druid.sql.dialect.mysql.ast.MySqlObjectImpl;
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;
import java.util.ArrayList;
import java.util.List;

public class MySqlLockTableStatement extends MySqlStatementImpl {
   private List<Item> items = new ArrayList();

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

      visitor.endVisit(this);
   }

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

   public void setItems(List<Item> items) {
      this.items = items;
   }

   public static enum LockType {
      READ("READ"),
      READ_LOCAL("READ LOCAL"),
      WRITE("WRITE"),
      LOW_PRIORITY_WRITE("LOW_PRIORITY WRITE");

      public final String name;

      private LockType(String name) {
         this.name = name;
      }
   }

   public static class Item extends MySqlObjectImpl {
      private SQLExprTableSource tableSource = new SQLExprTableSource();
      private LockType lockType;
      private List<SQLCommentHint> hints;

      public void accept0(MySqlASTVisitor visitor) {
         if (visitor.visit(this)) {
            this.acceptChild(visitor, this.tableSource);
         }

         visitor.endVisit(this);
      }

      public SQLExprTableSource getTableSource() {
         return this.tableSource;
      }

      public void setTableSource(SQLExprTableSource tableSource) {
         if (tableSource != null) {
            tableSource.setParent(this);
         }

         this.tableSource = tableSource;
      }

      public LockType getLockType() {
         return this.lockType;
      }

      public void setLockType(LockType lockType) {
         this.lockType = lockType;
      }

      public List<SQLCommentHint> getHints() {
         return this.hints;
      }

      public void setHints(List<SQLCommentHint> hints) {
         this.hints = hints;
      }
   }
}
