package it.enea.cruise.dto;

import java.util.ArrayList;
import java.util.List;


import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@NoArgsConstructor
@ToString
public class FieldDTO {

		private String example;
	    private Boolean required;
	    private String  name;
	    private String description;
	    private String type;
	    
	    private List<String> value;
	    
	    private List<OptionDTO> options;
	    
	    private List<OptionDTO> multipleOptions;
	    
	    @SuppressWarnings("unused")
		private void setValue (Object value){
	    	List<String> result = new ArrayList<String>();
	    	if (value instanceof java.lang.String) {
	    		result.add(value.toString());
	    	}
	    	else if (value instanceof java.util.List) {
	    		for (Object v : (List<Object>) value) {
	    			if (value instanceof java.lang.Number) result.add(value.toString());
	    			if (value instanceof java.lang.Integer) result.add(value.toString());
	    			if (value instanceof java.lang.String) result.add(value.toString());
	    			}
	    	}
	    	else if (value instanceof java.lang.Number) result.add(value.toString());
	    	this.value = result;
	    }
		
}
