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

import com.chenyang.druid.sql.ast.SQLDataType;
import com.chenyang.druid.sql.ast.SQLExpr;
import com.chenyang.druid.sql.ast.SQLName;
import com.chenyang.druid.sql.ast.SQLObject;
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 MariadbJSONTableExpr extends MariadbExprImpl {
   private final List<Column> columns = new ArrayList();
   private SQLExpr expr;
   private SQLExpr path;

   public void accept0(MariadbASTVisitor v) {
      if (v.visit(this)) {
         this.acceptChild(v, this.expr);
         this.acceptChild(v, this.path);
         this.acceptChild(v, this.columns);
      }

      v.endVisit(this);
   }

   public List<SQLObject> getChildren() {
      return null;
   }

   public SQLExpr getExpr() {
      return this.expr;
   }

   public void setExpr(SQLExpr x) {
      if (x != null) {
         x.setParent(this);
      }

      this.expr = x;
   }

   public SQLExpr getPath() {
      return this.path;
   }

   public void setPath(SQLExpr x) {
      if (x != null) {
         x.setParent(this);
      }

      this.path = x;
   }

   public List<Column> getColumns() {
      return this.columns;
   }

   public void addColumn(Column column) {
      column.setParent(this);
      this.columns.add(column);
   }

   public static class Column extends MariadbObjectImpl {
      private final List<Column> nestedColumns = new ArrayList();
      private SQLName name;
      private SQLDataType dataType;
      private SQLExpr path;
      private boolean ordinality;
      private boolean exists;
      private SQLExpr onError;
      private SQLExpr onEmpty;

      public void accept0(MariadbASTVisitor v) {
         if (v.visit(this)) {
            this.acceptChild(v, this.name);
            this.acceptChild(v, this.dataType);
            this.acceptChild(v, this.path);
            this.acceptChild(v, this.onEmpty);
            this.acceptChild(v, this.onError);
         }

         v.endVisit(this);
      }

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

      public void setName(SQLName x) {
         if (x != null) {
            x.setParent(this);
         }

         this.name = x;
      }

      public SQLDataType getDataType() {
         return this.dataType;
      }

      public void setDataType(SQLDataType x) {
         if (x != null) {
            x.setParent(this);
         }

         this.dataType = x;
      }

      public SQLExpr getPath() {
         return this.path;
      }

      public void setPath(SQLExpr x) {
         if (x != null) {
            x.setParent(this);
         }

         this.path = x;
      }

      public boolean isOrdinality() {
         return this.ordinality;
      }

      public void setOrdinality(boolean ordinality) {
         this.ordinality = ordinality;
      }

      public boolean isExists() {
         return this.exists;
      }

      public void setExists(boolean exists) {
         this.exists = exists;
      }

      public SQLExpr getOnError() {
         return this.onError;
      }

      public void setOnError(SQLExpr x) {
         if (x != null) {
            x.setParent(this);
         }

         this.onError = x;
      }

      public SQLExpr getOnEmpty() {
         return this.onEmpty;
      }

      public void setOnEmpty(SQLExpr x) {
         if (x != null) {
            x.setParent(this);
         }

         this.onEmpty = x;
      }

      public List<Column> getNestedColumns() {
         return this.nestedColumns;
      }

      public void addNestedColumn(Column column) {
         column.setParent(this);
         this.nestedColumns.add(column);
      }
   }
}
