{
"propertyTemplates":[
		{
			"placeholder" : "{{File_Prop_Definitions_Here}}",
			"templates" : [
					{
					"type" : "file",
					"content" : "					
                        private const long Max{{Property_Name_Here}}Length = 5242880; //5MB
                        private const string Max{{Property_Name_Here}}LengthUserFriendlyValue = \"5MB\"; //5MB
                        private readonly string[] {{Property_Name_Here}}AllowedFileTypes = {\"jpeg\", \"jpg\", \"png\"};
                    "
					}
				]
		},
		{
			"placeholder" : "{{File_Upload_Action_Here}}",
			"templates" : [
					{
					"type" : "file",
					"content" : "
					   public FileUploadCacheOutput Upload{{Property_Name_Here}}File()
                       {
                           try
                           {
                               //Check input
                               if (Request.Form.Files.Count == 0)
                               {
                                   throw new UserFriendlyException(L(\"NoFileFoundError\"));
                               }
               
                               var file = Request.Form.Files.First();
                               if (file.Length > Max{{Property_Name_Here}}Length)
                               {
                                   throw new UserFriendlyException(L(\"Warn_File_SizeLimit\", Max{{Property_Name_Here}}LengthUserFriendlyValue));
                               }
               
                               var fileType = Path.GetExtension(file.FileName).Substring(1);
                               if ({{Property_Name_Here}}AllowedFileTypes != null && {{Property_Name_Here}}AllowedFileTypes.Length > 0 && !{{Property_Name_Here}}AllowedFileTypes.Contains(fileType))
                               {
                                   throw new UserFriendlyException(L(\"FileNotInAllowedFileTypes\", {{Property_Name_Here}}AllowedFileTypes));
                               }
               
                               byte[] fileBytes;
                               using (var stream = file.OpenReadStream())
                               {
                                   fileBytes = stream.GetAllBytes();
                               }
               
                               var fileToken = Guid.NewGuid().ToString(\"N\");
                               _tempFileCacheManager.SetFile(fileToken, new TempFileInfo(file.FileName, fileType, fileBytes));
                               
                               return new FileUploadCacheOutput(fileToken);
                           }
                           catch (UserFriendlyException ex)
                           {
                               return new FileUploadCacheOutput(new ErrorInfo(ex.Message));
                           }
                       }
                    "
					}
				]
		},
		{
			"placeholder" : "{{File_Upload_Get_Accepted_File_Types_Here}}",
			"templates" : [
					{
					"type" : "file",
					"content" : "
                        public string[] Get{{Property_Name_Here}}FileAllowedTypes()
                        {
                            return {{Property_Name_Here}}AllowedFileTypes;
                        }
                    "
					}
				]
		}
	],
"conditionalTemplates":[
		{
            "placeholder": "{{Overridable_Entity_Base_Here}}",
            "condition": "{{Generate_Overridable_Entity_Here}} == true",
            "content": "Base"
        },		
        {
            "placeholder": "{{Controller_Base_Class_Here}}",
            "condition": "{{Create_Excel_Import_Here}} == true",
            "content": "ExcelImportControllerBase"
        },
        {
            "placeholder": "{{Controller_Base_Class_Here}}",
            "condition": "{{Create_Excel_Import_Here}} == false",
            "content": "{{Project_Name_Here}}ControllerBase"
        },
        {
            "placeholder": "{{ExcelImportBase_Prop_Cons_Here}}",
            "condition": "{{Create_Excel_Import_Here}} == true",
            "content": ", IBinaryObjectManager binaryObjectManager, IBackgroundJobManager backgroundJobManager"
        },
        {
            "placeholder": "{{ExcelImportBase_Prop_Init_Here}}",
            "condition": "{{Create_Excel_Import_Here}} == true",
            "content": "
                        protected readonly IBinaryObjectManager _binaryObjectManager;
                        protected readonly IBackgroundJobManager _backgroundJobManager;
                        "
        },
        {
            "placeholder": "{{ExcelImportBase_Prop_Define_Here}}",
            "condition": "{{Create_Excel_Import_Here}} == true",
            "content": "
                        _binaryObjectManager = binaryObjectManager;
                        _backgroundJobManager = backgroundJobManager;
                        "
        },
        {
            "placeholder": "{{Override_ImportExcelPermission_Here}}",
            "condition": "{{Create_Excel_Import_Here}} == true",
            "content": "
                        public override string ImportExcelPermission => AppPermissions.{{Permission_Name_Here}}_Create;
                        "
        },
        {
            "placeholder": "{{Override_EnqueueExcelImportJobAsync_Here}}",
            "condition": "{{Create_Excel_Import_Here}} == true",
            "content": "
                        public override async Task EnqueueExcelImportJobAsync(ImportFromExcelJobArgs args)
                        {
                            await BackgroundJobManager.EnqueueAsync<Import{{Entity_Name_Plural_Here}}ToExcelJob, ImportFromExcelJobArgs>(args);
                        }
                        "
        },
        {
            "placeholder": "{{ExcelImport_Props_Usings_Here}}",
            "condition": "{{Create_Excel_Import_Here}} == true",
            "content": "
                        using Abp.BackgroundJobs;
                        using {{Namespace_Here}}.DataImporting.Excel;
                        using {{Namespace_Here}}.Web.Controllers;
                        using {{Namespace_Here}}.Authorization;
                        using System.Threading.Tasks;
                        using {{Namespace_Here}}.{{Namespace_Relative_Full_Here}};
                        "
        },
        {
            "placeholder": "{{Initialize_Base_Here}}",
            "condition": "{{Create_Excel_Import_Here}} == true",
            "content": " : base(binaryObjectManager, backgroundJobManager)"
        },
        {
            "placeholder": "{{Overridable_Entity_Abstract_Here}}",
            "condition": "{{Generate_Overridable_Entity_Here}} == true",
            "content": " abstract"
        },
	]    
}


