package kz.cafe.admin.panels.model;

public class CustomField implements java.io.Serializable{
   private static final long serialVersionUID = 653472427285426925L;
   
   public String name;
   public String db;
   
   public boolean visible;
   public boolean isEditable;
   
   
   public boolean isSortable;
   public boolean isMust;  
   
   
   public enum Alignment{LEFT, CENTER, RIGHT};
   
   
   
   public static class Style implements java.io.Serializable{
      
      private static final long serialVersionUID = 2852972181940574257L;
      public int width;
      public int height;
      public boolean expandable = true;
      public Alignment alignment = Alignment.LEFT;
   }
   public final Style style = new Style();

   
   
   
   public static class Search implements java.io.Serializable{
      private static final long serialVersionUID = 1347370899146848147L;
      
      public enum SEARCH_MODES{NONE,
                               INTEGER,
                               INTEGER_RANGE,
                               STRING, LOCALIZED_STRING,
                               BOOLEAN,
                               BOOLEAN_ONLY_TRUE,
                               DATE,
                               DATE_RANGE,
                               TIME_RANGE};
         
      public SEARCH_MODES mode = SEARCH_MODES.NONE;
    
      
      public int row = 0;
      public int cell;
   }
   public final Search search = new Search();
   
   
   
   
   
   
   
   @Override
   public int hashCode(){
      final int prime = 31;
      int result = 1;
      result = prime * result + ((db == null) ? 0 : db.hashCode());
      return result;
   }







   @Override
   public boolean equals(Object obj){
      if(this == obj)
         return true;
      if(obj == null)
         return false;
      if(getClass() != obj.getClass())
         return false;
      CustomField other = (CustomField) obj;
      if(db == null){
         if(other.db != null)
            return false;
      }
      else if(!db.equals(other.db))
         return false;
      return true;
   }







   @Override
   public String toString(){
      return "CustomField [name=" + name + ", db=" + db + ", getClass()=" + getClass() + "]";
   }
}
