using APT.Infrastructure.Core;
using System;
using APT.Infrastructure.Api;
using APT.MS.Domain.Entities.AE;
using APT.MS.Domain.Enums;
using APT.BaseData.Domain.IServices.AE;

namespace APT.BaseData.Services.Services.AE
{
    public partial class AEAccidentEventReportService : CommonService, IAEAccidentEventReportService
    {
        public AEAccidentEventReportService(IRepository repository)
            : base(repository)
        {
        }

        /// <summary>
        /// 获取审批流参数
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public string GetApproveParm(T_AE_ACCIDENT_EVENT_REPORT entity)
        {
            string param = string.Empty;
            switch (entity.ACCIDENT_LEVEL)
            {
                case AEAccidentLevel.Jumbo:
                case AEAccidentLevel.Major:
                case AEAccidentLevel.Larger:
                case AEAccidentLevel.General:
                case AEAccidentLevel.SeriouslyInjured:
                    param = "1_2_3_4_5";
                    break;

                case AEAccidentLevel.MinorJuries:
                    param = "6";
                    break;
                case AEAccidentLevel.Aminor:
                    param = "7";
                    break;
                case AEAccidentLevel.Risk:
                    if (entity.ECONOMIC_LOSSES.HasValue && entity.ECONOMIC_LOSSES.Value >= 5000)
                    {
                        param = "8>=5000";
                    }
                    else
                    {
                        param = "8<5000";
                    }
                    break;
                default:
                    break;
            }
            return param;
        }
    }
}
