package de.starwit.dto;

import java.util.List;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.xml.bind.annotation.XmlRootElement;

import org.hibernate.validator.constraints.Length;

import de.starwit.persistence.entity.AbstractEntity;
import io.swagger.v3.oas.annotations.media.Schema;

@Schema
@XmlRootElement
public class FieldDto extends AbstractEntity<Long> {
    
    @Schema(defaultValue = "defaultField")
    @NotBlank
	@Pattern(regexp = "^[a-z][a-zA-Z0-9]*$")
	@Length(max = 100)
    private String fieldName;

    @Schema(defaultValue = "String")
    @NotNull
    private FieldType fieldType;
    
    private List<FieldValidateRulesType> fieldValidateRules;
    private Integer fieldValidateRulesMin;
    private Integer fieldValidateRulesMax;
    private Integer fieldValidateRulesMinlength;
    private Integer fieldValidateRulesMaxlength;
    private String fieldValidateRulesPattern;
    private String fieldValidateRulesPatternJava;
    
    public String getFieldName() {
        return fieldName;
    }
    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }
    public FieldType getFieldType() {
        return fieldType;
    }
    public void setFieldType(FieldType fieldType) {
        this.fieldType = fieldType;
    }
    public List<FieldValidateRulesType> getFieldValidateRules() {
        return fieldValidateRules;
    }
    public void setFieldValidateRules(List<FieldValidateRulesType> fieldValidateRules) {
        this.fieldValidateRules = fieldValidateRules;
    }
    public Integer getFieldValidateRulesMin() {
        return fieldValidateRulesMin;
    }
    public void setFieldValidateRulesMin(Integer fieldValidateRulesMin) {
        this.fieldValidateRulesMin = fieldValidateRulesMin;
    }
    public Integer getFieldValidateRulesMax() {
        return fieldValidateRulesMax;
    }
    public void setFieldValidateRulesMax(Integer fieldValidateRulesMax) {
        this.fieldValidateRulesMax = fieldValidateRulesMax;
    }
    public Integer getFieldValidateRulesMinlength() {
        return fieldValidateRulesMinlength;
    }
    public void setFieldValidateRulesMinlength(Integer fieldValidateRulesMinlength) {
        this.fieldValidateRulesMinlength = fieldValidateRulesMinlength;
    }
    public Integer getFieldValidateRulesMaxlength() {
        return fieldValidateRulesMaxlength;
    }
    public void setFieldValidateRulesMaxlength(Integer fieldValidateRulesMaxlength) {
        this.fieldValidateRulesMaxlength = fieldValidateRulesMaxlength;
    }
    public String getFieldValidateRulesPattern() {
        return fieldValidateRulesPattern;
    }
    public void setFieldValidateRulesPattern(String fieldValidateRulesPattern) {
        this.fieldValidateRulesPattern = fieldValidateRulesPattern;
    }
    public String getFieldValidateRulesPatternJava() {
        return fieldValidateRulesPatternJava;
    }
    public void setFieldValidateRulesPatternJava(String fieldValidateRulesPatternJava) {
        this.fieldValidateRulesPatternJava = fieldValidateRulesPatternJava;
    }

}

@@ -462,21 +462,17 @@
 Long%3E %7B%0A
-    
 %0A
+
     @Sch
@@ -520,17 +520,20 @@
 otBlank%0A
-%09
+    
 @Pattern
@@ -569,9 +569,12 @@
 $%22)%0A
-%09
+    
 @Len
@@ -702,21 +702,17 @@
 ldType;%0A
-    
 %0A
+
     priv
@@ -1044,20 +1044,403 @@
 rnJava;%0A
+%0A
     
+public boolean getRequired() %7B%0A        if (fieldValidateRules != null && !fieldValidateRules.isEmpty()) %7B%0A            for (FieldValidateRulesType fieldValidateRulesType : fieldValidateRules) %7B%0A                if (FieldValidateRulesType.required.equals(fieldValidateRulesType)) %7B%0A                    return true;%0A                %7D%0A            %7D%0A        %7D%0A        return false;%0A    %7D%0A
 %0A    pub
@@ -1491,32 +1491,33 @@
 ieldName;%0A    %7D%0A
+%0A
     public void 
@@ -1583,32 +1583,33 @@
 ieldName;%0A    %7D%0A
+%0A
     public Field
@@ -1654,32 +1654,33 @@
 ieldType;%0A    %7D%0A
+%0A
     public void 
@@ -1749,32 +1749,33 @@
 ieldType;%0A    %7D%0A
+%0A
     public List%3C
@@ -1857,32 +1857,33 @@
 ateRules;%0A    %7D%0A
+%0A
     public void 
@@ -2007,32 +2007,33 @@
 ateRules;%0A    %7D%0A
+%0A
     public Integ
@@ -2100,32 +2100,33 @@
 RulesMin;%0A    %7D%0A
+%0A
     public void 
@@ -2241,32 +2241,33 @@
 RulesMin;%0A    %7D%0A
+%0A
     public Integ
@@ -2334,32 +2334,33 @@
 RulesMax;%0A    %7D%0A
+%0A
     public void 
@@ -2475,32 +2475,33 @@
 RulesMax;%0A    %7D%0A
+%0A
     public Integ
@@ -2580,32 +2580,33 @@
 inlength;%0A    %7D%0A
+%0A
     public void 
@@ -2745,32 +2745,33 @@
 inlength;%0A    %7D%0A
+%0A
     public Integ
@@ -2850,32 +2850,33 @@
 axlength;%0A    %7D%0A
+%0A
     public void 
@@ -3015,32 +3015,33 @@
 axlength;%0A    %7D%0A
+%0A
     public Strin
@@ -3115,32 +3115,33 @@
 sPattern;%0A    %7D%0A
+%0A
     public void 
@@ -3271,32 +3271,33 @@
 sPattern;%0A    %7D%0A
+%0A
     public Strin
@@ -3381,22 +3381,23 @@
 rnJava;%0A
-
     %7D%0A
+%0A
     publ

add getRequired