using Brizco.Domain.Entities.Complex;
using Brizco.Domain.Entities.Shift;
using Mapster;

namespace Brizco.Domain;

public class MapsterRegister : IRegister
{
    public void Register(TypeAdapterConfig config)
    {
        config.NewConfig<Shift, ShiftSDto>()
            .TwoWays();


        config.NewConfig<ComplexUserRole, ComplexUserRoleSDto>()
            .Map("RoleName", org => org.Role!.PersianName)
            .TwoWays();

        config.NewConfig<ComplexUser, ComplexUserSDto>()
            .Map("ComplexName", o=>o.Complex!=null ? o.Complex.Name : string.Empty)
            .Map("FirstName", o=>o.User!=null ? o.User.FirstName : string.Empty)
            .Map("LastName", o=>o.User!=null ? o.User.LastName : string.Empty)
            .Map("NationalId", o=>o.User!=null ? o.User.NationalId : string.Empty)
            .TwoWays();
    }
}