using APT.BaseData.Domain.ApiModel;
using APT.BaseData.Domain.Entities;
using APT.BaseData.Domain.Enums;
using APT.Infrastructure.Core;
using System;
using System.Collections.Generic;
using APT.Infrastructure.Api;
namespace APT.BaseData.Domain.IServices
{
	public interface IPFFormService : ICommonService
	{
		/// <summary>
		/// 获取实体语法
		/// </summary>
		/// <param name="dataBaseType"></param>
		/// <param name="obj"></param>
		/// <param name="list"></param>
		/// <param name="dstOrgId"></param>
		/// <param name="sqlType">获取语法类型 0-update 和insert  1-仅获取update 2-仅获取insert</param>
		void GetSqlByObject(DataBaseType dataBaseType, object obj, List<string> list, string dstOrgId, int sqlType);

		/// <summary>
		/// 创建表单设置版本信息
		/// </summary>
		/// <param name="configEnum">当前设置类型</param>
		/// <param name="ids">ID列表 逗号隔开</param>
		void CreateFormConfigVersion(PFFormConfigVersionEnum configEnum,  string ids);


		/// <summary>
		/// 依据表单编号获取更新表单配置语法
		/// </summary>
		/// <param name="orgId"></param>
		/// <param name="formCodes"></param>
		/// <param name="dstOrgId"></param>
		/// <param name="dstFormConfigVersion"></param>
		/// <param name="dstDataBaseType"></param>
		/// <param name="sqlType"></param>
		/// <param name="startTime">开始时间  从此时间之后的有异动的配置信息都会获取到</param>
		/// <param name="isInitOrg">是否组织初始化</param>
		/// <returns></returns>
		List<string> GetSqlsByFormCode(Guid orgId, List<string> formCodes, string dstOrgId, decimal dstFormConfigVersion, DataBaseType dstDataBaseType, int sqlType, DateTime? startTime, bool isInitOrg);


		/// <summary>
		/// 依据表单ID获取更新表单配置语法
		/// </summary>
		/// <param name="orgId"></param>
		/// <param name="formIds"></param>
		/// <param name="dstOrgId"></param>
		/// <param name="dstFormConfigVersion"></param>
		/// <param name="dstDataBaseType"></param>
		/// <param name="sqlType"> 获取语法类型 0-update 和insert  1-仅获取update 2-仅获取insert</param>
		/// <param name="startTime">开始时间  从此时间之后的有异动的配置信息都会获取到</param>
		/// <param name="isInitOrg">是否组织初始化</param>
		/// <returns></returns>
		List<string> GetSqlsByFormId(Guid orgId, List<Guid> formIds, string dstOrgId, decimal dstFormConfigVersion, DataBaseType dstDataBaseType, int sqlType, DateTime? startTime, bool isInitOrg, int formType);


		/// <summary>
		/// 获取实体表语法
		/// </summary>
		/// <param name="orgId"></param>
		/// <param name="dataBaseType"></param>
		/// <param name="entityNames"></param>
		/// <param name="dstOrgId"></param>
		/// <param name="sqlType"> 获取语法类型 0-update 和insert  1-仅获取update 2-仅获取insert</param>
		/// <returns></returns>
		List<string> GetSqlByEntity(DataBaseType dataBaseType, Guid orgId, string entityNames, string dstOrgId, int sqlType);



		/// <summary>
		///根据来源组织初始化目的组织 配置数据
		/// </summary>
		/// <param name="srcOrgCode">来源组织编号</param>
		/// <param name="destOrgCode">目的组织编号</param>
		/// <param name="destOrgName">目的组织名称</param>
		void InitOrgBySrcOrg(string srcOrgCode, string destOrgCode, string destOrgName);

		/// <summary>
		/// 初始化组织
		/// </summary>
		/// <param name="srcOrgId"></param>
		/// <param name="destOrgIds"></param>
		/// <param name="startTime"></param>
		void InitOrgByOrg(Guid srcOrgId, List<Guid> destOrgIds, DateTime? startTime);

		/// <summary>
		/// 同步表单配置信息
		/// </summary>
		/// <param name="srcOrgId"></param>
		/// <param name="destOrgIds"></param>
		/// <param name="startTime"></param>
		void SynchFormConfigByOrg(Guid srcOrgId, List<Guid> destOrgIds, DateTime? startTime);

		/// <summary>
		/// 执行语法并且获取执行结果
		/// </summary>
		/// <param name="sql"></param>
		/// <returns></returns>
		ExecuteSqlResult ExcuteSqlAndGetResult(string sql);


        /// <summary>
        /// 根据表名获取模块类型
        /// </summary>
        /// <param name="tableName"></param>
        /// <returns></returns>
        PFModuleTypeEnum GetModelTypeByName(string tableName);


        /// <summary>
        /// 获取表单配置版本
        /// </summary>
        /// <param name="formIds"></param>
        /// <param name="pageTables"></param>
        /// <param name="columns"></param>
        /// <param name="pageTablePanels"></param>
        /// <param name="otherCookies"></param>
        void AddFormConfigVersion(List<Guid> formIds, List<T_PF_PAGE_TABLE> pageTables,
       List<T_PF_COLUMN> columns, List<T_PF_PAGE_TABLE_PANEL> pageTablePanels,
        Dictionary<Guid, List<string>> otherCookies);



	}
}
