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

import com.chenyang.druid.sql.ast.SQLCommentHint;
import com.chenyang.druid.sql.ast.statement.SQLExprTableSource;
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 MariadbLockTableStatement extends MariadbStatementImpl {
   private List<Item> items = new ArrayList();

   public void accept0(MariadbASTVisitor 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 MariadbObjectImpl {
      private SQLExprTableSource tableSource = new SQLExprTableSource();
      private LockType lockType;
      private List<SQLCommentHint> hints;

      public void accept0(MariadbASTVisitor 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;
      }
   }
}
