package io.asfjava.ui.core.schema;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.BeanProperty;
import com.fasterxml.jackson.module.jsonSchema.types.StringSchema;

import io.asfjava.ui.core.form.ComboBox;
import io.asfjava.ui.core.form.TextArea;
import io.asfjava.ui.core.form.TextField;

class CustomStringSchema extends StringSchema {
	@JsonProperty
	private String layout;

	@Override
	public void enrichWithBeanProperty(BeanProperty beanProperty) {
		super.enrichWithBeanProperty(beanProperty);
		TextField annotation = beanProperty.getAnnotation(TextField.class);
		if (annotation != null) {
			// this.setLayout(annotation.value().toString());
			this.setTitle(annotation.title());
		}
		ComboBox Comboannotation = beanProperty.getAnnotation(ComboBox.class);
		if (Comboannotation != null) {
			this.setTitle(Comboannotation.title());
			Set<String> enums = new HashSet<>(Arrays.asList(Comboannotation.values()));
			this.setEnums(enums);
		}
		TextArea textArea = beanProperty.getAnnotation(TextArea.class);
		if (textArea != null) {
			this.setTitle(textArea.title());
		}
	}

	String getLayout() {
		return layout;
	}

	void setLayout(String layout) {
		this.layout = layout;
	}
}

@@ -318,16 +318,57 @@
 mboBox;%0A
+import io.asfjava.ui.core.form.Password;%0A
 import i
@@ -441,16 +441,55 @@
 xtField;
+%0Aimport io.asfjava.ui.core.form.Number;
 %0A%0Aclass 
@@ -1274,16 +1274,270 @@
 ));%0A%09%09%7D%0A
+%09%09Password password = beanProperty.getAnnotation(Password.class);%0A%09%09if (password != null) %7B%0A%09%09%09this.setTitle(password.title());%0A%09%09%7D%0A%09%09Number number = beanProperty.getAnnotation(Number.class);%0A%09%09if (number != null) %7B%0A%09%09%09this.setTitle(number.title());%0A%09%09%7D%0A
 %09%7D%0A%0A%09Str

Add custon string shema to number ad password