using APT.BaseData.Domain.ApiModel.PF;
using APT.BaseData.Domain.Entities;
using APT.BaseData.Domain.Entities.FM;
using APT.BaseData.Domain.Enums;
using APT.BaseData.Domain.IServices;
using APT.BaseData.Domain.IServices.FM;
using APT.Infrastructure.Core;
using APT.MS.Domain.Entities.BS;
using APT.MS.Domain.Entities.HM;
using APT.MS.Domain.Enums;
using APT.Utility;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;

namespace APT.BS.WebApi.Controllers.Api
{
    /// <summary>
    /// 日志
    /// </summary>
    [Route("api/PF/PFSysLog")]
    public partial class PFSysLogController : AuthorizeApiController<T_PF_SYS_LOG>
    {
        IPFSysLogService SysLogService { get; set; }
        /// <summary>
        /// 日志
        /// </summary>
        /// <param name="sysLogService"></param>
        public PFSysLogController(IPFSysLogService sysLogService)
        {
            SysLogService = sysLogService;
        }

        /// <summary>
        /// 日志
        /// </summary>
        /// <param name="filter">Parameter1:formCode  2:title 3:data 4:extData</param>
        /// <returns></returns>
        [HttpPost, Route("addLog")]
        public JsonActionResult<bool> addLog([FromBody] KeywordFilter filter)
        {
            return SafeExecute<bool>(() =>
            {
                SysLogService.AddLog(filter.OrgId.Value, APT.Infrastructure.Api.AppContext.CurrentSession.UserID.Value, PFSysLogTypeEnum.Common, filter.Parameter1, filter.Parameter2, filter.Parameter3, filter.Parameter4);
                return true;
            });
        }
    }

}