using SafeCampus.Application.Services.Business.AttendanceService;

namespace SafeCampus.Application.Services.Business.DormitoryService;

public class ReturnDormitoryDto: DormitoryInfoDto
{
    public List<AttendanceDto> AttendanceDtos { get; set; }
}
public class ReturnDormitoryDtoMapper : IRegister
{
    public void Register(TypeAdapterConfig config)
    {
        config.ForType<DormitoryInfo, ReturnDormitoryDto>()
            .Map(x => x.AttendanceDtos,
                x => x.PersonInfos.Any(xx=>xx.Attendances.Any())? x.PersonInfos.SelectMany(xx => xx.Attendances):null);
    }
}