using DataSharing.Share.Dtos.LuZhou;
using Mapster;

namespace DataSharing.Application.Mappers
{
    public class LZ110MapperRegisters : IRegister
    {
        public void Register(TypeAdapterConfig config)
        {
            config.NewConfig<LZ110BaseResponse, LZ110ApiResponse<LZ110BaseResponse>>()
                .Ignore(d => d.Data)
                .Map(d => d.Message, x => x.ResponseStatusObject.StatusString)
                .AfterMapping((s, d) =>
                {
                    var success = int.TryParse(s.ResponseStatusObject.StatusCode, out var code);
                    d.Code = success ? code : 1;
                });


        }
    }
}
