public class FieldInfo
{
    @AuraEnabled public string TypeEnumName{get;set;}
    @AuraEnabled public string Label{get;set;}
    @AuraEnabled public string Name{get;set;}
    @AuraEnabled public object Value{get;set;}
    //@AuraEnabled public schema.DisplayType DisplayType{get;set;}
    @AuraEnabled public List<Option> Options{get;set;}
	@AuraEnabled public boolean IsRequired{get;set;}
    @AuraEnabled public List<Option> References{get;set;}
    
    public Option GetFirstItemByLabel(string label){
        if(Options == null)return null;
        for(Option lv : Options){
            if(lv!=null&&lv.value == label)return lv;
        }
        return null;
    }
    
    public Option GetFirstItemByValue(string val){
        if(Options == null)return null;
        for(Option lv : Options){
            if(lv!=null&&lv.value == val)return lv;
        }
        return null;
    }
    
   public static void CopyTo(FieldInfo source,FieldInfo target)
   {
       if(source == null || target == null )
       {
           return;
       }
       
       target.TypeEnumName = source.TypeEnumName;
       target.Label = source.Label;
       target.Name = source.Name;
       target.IsRequired = source.IsRequired;
       target.Options = source.Options;
       target.Value = source.Value;
   }
    
    
}