{
"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_Props_Usings_Here}}",
			"templates" : [
					{
					"type" : "file",
					"preventDuplicate": true,
					"content" : "
					using System.IO;
					using System.Linq;
                    using Abp.Web.Models;
                    using Abp.UI;
                    using Abp.IO.Extensions;
					using {{Namespace_Here}}.Storage;"               					
					}
				]
		},
		{
			"placeholder" : "{{TempFileCacheManager_Prop_Init_Here}}",
			"templates" : [
					{
					"type" : "file",
					"preventDuplicate": true,
					"content" : "private readonly ITempFileCacheManager _tempFileCacheManager;"
					}
				]
		},
		{
			"placeholder" : "{{TempFileCacheManager_Prop_Cons_Here}}",
			"templates" : [
					{
					"type" : "file",
					"preventDuplicate": true,
					"content" : ", ITempFileCacheManager tempFileCacheManager"
					}
				]
		},
		{
			"placeholder" : "{{TempFileCacheManager_Prop_Define_Here}}",
			"templates" : [
					{
					"type" : "file",
					"preventDuplicate": true,
					"content" : "_tempFileCacheManager = tempFileCacheManager;"
					}
				]
		},
		{
			"placeholder" : "{{Property_Init_Here}}",
			"condition" : "{{Property_CreateOrEdit_Here}} == true",
			"templates" : [
					{
					"type" : "DateTime",
					"content" : "
				get{{Entity_Name_Here}}ForEditOutput.{{Entity_Name_Here}}.{{Property_Name_Here}} = DateTime.Now;"
					}
				]
		},
		{
			"placeholder" : "{{Get_File_Upload_Output_Here}}",
			"templates" : [
					{
					"type" : "file",
					"content" : "{{Property_Name_Here}}FileName = get{{Entity_Name_Here}}ForEditOutput.{{Property_Name_Here}}FileName,"
					}
				]
		},
        {
			"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" : "{{Get_File_Upload_Accepted_Types_Here}}",
			"templates" : [
					{
					"type" : "file",
					"content" : "
                        foreach (var {{Property_Name_Here}}AllowedFileType in {{Property_Name_Here}}AllowedFileTypes)
                        {
                            viewModel.{{Property_Name_Here}}FileAcceptedTypes += \".\" + {{Property_Name_Here}}AllowedFileType + \",\";
                        }
					"
					}
				]
		},
	],
"navigationPropertyTemplates":[
		{
			"placeholder" : "{{NP_Looped_Display_Property_Init_Here}}",
			"templates" : [
					{
					"relation" : "single",
					"content" : ",
					{{NP_Foreign_Entity_Name_Here}}{{NP_Display_Property_Name_Here}}{{NP_Duplication_Number_Here}} = get{{Entity_Name_Here}}ForEditOutput.{{NP_Foreign_Entity_Name_Here}}{{NP_Display_Property_Name_Here}}{{NP_Duplication_Number_Here}}"
					}
				]
		},
		{
			"placeholder" : "{{NP_Looped_Dropdown_Init_Here}}",
			"templates" : [
					{
					"relation" : "single",
					"viewType": "Dropdown",						
					"preventDuplicate":true,
					"content" : ",
					{{Entity_Name_Here}}{{NP_Foreign_Entity_Name_Here}}List = await _{{entity_Name_Plural_Here}}AppService.GetAll{{NP_Foreign_Entity_Name_Here}}ForTableDropdown()"
					}
				]
		},
		{
			"placeholder" : "{{NP_Looped_Controller_Here}}",
			"templates" : [
					{
					"relation" : "single",
					"viewType":"LookupTable",
					"preventDuplicate" : true,
					"content" : "        [AbpMvcAuthorize(AppPermissions.{{Permission_Name_Here}}_Create, AppPermissions.{{Permission_Name_Here}}_Edit)]
        public PartialViewResult {{NP_Foreign_Entity_Name_Here}}LookupTableModal({{NP_Id_Type_Here}}? id, string displayName)
        {
            var viewModel = new {{Entity_Name_Here}}{{NP_Foreign_Entity_Name_Here}}LookupTableViewModel()
            {
                Id = id{{NP_Id_Type_ToStringIfNeeded_Here}},
                DisplayName = displayName,
                FilterText = \"\"
            };

            return PartialView(\"_{{Entity_Name_Here}}{{NP_Foreign_Entity_Name_Here}}LookupTableModal\", viewModel);
        }
"
					}
				]
		},
		{
			"placeholder" : "{{NP_Looped_ViewMethod_Here}}",
			"templates" : [
					{
					"relation" : "single",
					"preventDuplicate" : true,
					"content" : "
                , {{NP_Foreign_Entity_Name_Here}}{{NP_Display_Property_Name_Here}}{{NP_Duplication_Number_Here}} = get{{Entity_Name_Here}}ForViewDto.{{NP_Foreign_Entity_Name_Here}}{{NP_Display_Property_Name_Here}}{{NP_Duplication_Number_Here}} 
"
					}
				]
		}
	],
"conditionalTemplates":[
		{
			"placeholder": "{{Primary_Key_Inside_Tag_Here}}",
			"condition": "{{Primary_Key_Here}} != 'int'",
			"content": "<{{Primary_Key_Here}}>"
		},		
		{
			"placeholder": "{{Primary_Key_Nullable_If_Not_String_Here}}",
			"condition": "{{Primary_Key_Here}} != 'string'",
			"content": "?"
		},
		{
			"placeholder": "{{View_Method_Here}}",
			"condition": "{{Create_View_Only_Here}} == true && {{Is_Non_Modal_CRUD_Page}} == false",
			"content": "
        public async Task<PartialViewResult> View{{Entity_Name_Here}}Modal({{Primary_Key_Here}} id)
        {
			var get{{Entity_Name_Here}}ForViewDto = await _{{entity_Name_Plural_Here}}AppService.Get{{Entity_Name_Here}}ForView(id);

            var model = new {{Entity_Name_Here}}ViewModel()
            {
                {{Entity_Name_Here}} = get{{Entity_Name_Here}}ForViewDto.{{Entity_Name_Here}}{{NP_Looped_ViewMethod_Here}}
            };

            return PartialView(\"_View{{Entity_Name_Here}}Modal\", model);
        }"
		},
		{
            "placeholder": "{{Controller_Base_Here}}",
            "condition": "{{Create_Excel_Import_Here}} == false",
            "content": "{{Project_Name_Here}}ControllerBase"
        },
        {
            "placeholder": "{{Controller_Base_Here}}",
            "condition": "{{Create_Excel_Import_Here}} == true",
            "content": "ExcelImportControllerBase"
        },
        {
            "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}}.Storage;
						using {{Namespace_Here}}.DataImporting.Excel;
						using {{Namespace_Here}}.Web.Controllers;
                        "
        },
		{
            "placeholder": "{{Initialize_Base_Here}}",
            "condition": "{{Create_Excel_Import_Here}} == true",
            "content": " : base(binaryObjectManager, backgroundJobManager)"
        },
		{
			"placeholder": "{{View_Method_Here}}",
			"condition": "{{Create_View_Only_Here}} == true && {{Is_Non_Modal_CRUD_Page}} == true",
			"content": "
        public async Task<ActionResult> View{{Entity_Name_Here}}({{Primary_Key_Here}} id)
        {
			var get{{Entity_Name_Here}}ForViewDto = await _{{entity_Name_Plural_Here}}AppService.Get{{Entity_Name_Here}}ForView(id);

            var model = new {{Entity_Name_Here}}ViewModel()
            {
                {{Entity_Name_Here}} = get{{Entity_Name_Here}}ForViewDto.{{Entity_Name_Here}}{{NP_Looped_ViewMethod_Here}}
            };

            return View(model);
        }"
		},
		{
			"placeholder": "{{Create_Or_Edit_Here}}",
			"condition": "{{Is_Non_Modal_CRUD_Page}} == false",
			"content": "
			 [AbpMvcAuthorize(AppPermissions.{{Permission_Name_Here}}_Create, AppPermissions.{{Permission_Name_Here}}_Edit)]
			public async Task<PartialViewResult> CreateOrEditModal({{Primary_Key_Here}}{{Primary_Key_Nullable_If_Not_String_Here}} id)
			{
				Get{{Entity_Name_Here}}ForEditOutput get{{Entity_Name_Here}}ForEditOutput;

				if ({{Id_Null_Check_Here}}){
					get{{Entity_Name_Here}}ForEditOutput = await _{{entity_Name_Plural_Here}}AppService.Get{{Entity_Name_Here}}ForEdit(new EntityDto{{Primary_Key_Inside_Tag_Here}} { Id = ({{Primary_Key_Here}}) id });
				}
				else {
					get{{Entity_Name_Here}}ForEditOutput = new Get{{Entity_Name_Here}}ForEditOutput{
						{{Entity_Name_Here}} = new CreateOrEdit{{Entity_Name_Here}}Dto()
					};{{Property_Init_Here}}
				}

				var viewModel = new CreateOrEdit{{Entity_Name_Here}}ModalViewModel()
				{
					{{Entity_Name_Here}} = get{{Entity_Name_Here}}ForEditOutput.{{Entity_Name_Here}}{{NP_Looped_Display_Property_Init_Here}}{{NP_Looped_Dropdown_Init_Here}},					
					{{Get_File_Upload_Output_Here}}      
				};
				
				{{Get_File_Upload_Accepted_Types_Here}} 

				return PartialView(\"_CreateOrEditModal\", viewModel);
			}
			"
		},
		{
			"placeholder": "{{Create_Or_Edit_Here}}",
			"condition": "{{Is_Non_Modal_CRUD_Page}} == true",
			"content": "[AbpMvcAuthorize(AppPermissions.{{Permission_Name_Here}}_Create, AppPermissions.{{Permission_Name_Here}}_Edit)]
			public async Task<ActionResult> CreateOrEdit({{Primary_Key_Here}}{{Primary_Key_Nullable_If_Not_String_Here}} id)
			{
				Get{{Entity_Name_Here}}ForEditOutput get{{Entity_Name_Here}}ForEditOutput;

				if ({{Id_Null_Check_Here}}){
					get{{Entity_Name_Here}}ForEditOutput = await _{{entity_Name_Plural_Here}}AppService.Get{{Entity_Name_Here}}ForEdit(new EntityDto{{Primary_Key_Inside_Tag_Here}} { Id = ({{Primary_Key_Here}}) id });
				}
				else {
					get{{Entity_Name_Here}}ForEditOutput = new Get{{Entity_Name_Here}}ForEditOutput{
						{{Entity_Name_Here}} = new CreateOrEdit{{Entity_Name_Here}}Dto()
					};{{Property_Init_Here}}
				}

				var viewModel = new CreateOrEdit{{Entity_Name_Here}}ViewModel()
				{
					{{Entity_Name_Here}} = get{{Entity_Name_Here}}ForEditOutput.{{Entity_Name_Here}}{{NP_Looped_Display_Property_Init_Here}}{{NP_Looped_Dropdown_Init_Here}},                
				};

				return View(viewModel);
			}
			"
		},
		{
			"placeholder": "{{Excel_Column_Selection_Partial_Here}}",
			"condition": "{{Create_Excel_Export_Here}} == true && {{Project_Version_Here}} >= 130200",
			"content": "
                    public async Task<PartialViewResult> ExcelColumnSelectionModal(long? id)
                    {
                        var output = await _{{entity_Name_Plural_Here}}AppService.Get{{Entity_Name_Here}}ExcelColumnsToExcel();
                        var viewModel = new {{Entity_Name_Here}}ExcelColumnSelectionViewModel
                        {
                            {{Entity_Name_Here}}ExcelColumns = output
                        };
            
                        return PartialView(\"_ExcelColumnSelectionModal\", viewModel);
                    }
			"
		},
		{
			"placeholder": "{{Id_Null_Check_Here}}",
			"condition": "{{Primary_Key_Here}} != 'string'",
			"content": "id.HasValue"
		},
		{
			"placeholder": "{{Id_Null_Check_Here}}",
			"condition": "{{Primary_Key_Here}} == 'string'",
			"content": "!id.IsNullOrWhiteSpace()"
		},
		{
            "placeholder": "{{Overridable_Entity_Base_Here}}",
            "condition": "{{Generate_Overridable_Entity_Here}} == true",
            "content": "Base"
        },
        {
            "placeholder": "{{Overridable_Entity_Abstract_Here}}",
            "condition": "{{Generate_Overridable_Entity_Here}} == true",
            "content": " abstract"
        }
	]
}


