using System;
using System.Linq.Expressions;
using Brizco.Domain.Dtos.SmallDtos;
using Brizco.Domain.Entities.Shift;

namespace Brizco.Domain.Mappers
{
    public static partial class ShiftDayMapper
    {
        public static ShiftDay AdaptToShiftDay(this ShiftDaySDto p1)
        {
            return p1 == null ? null : new ShiftDay()
            {
                DayOfWeek = p1.DayOfWeek,
                ShiftId = p1.ShiftId,
                Id = p1.Id
            };
        }
        public static ShiftDay AdaptTo(this ShiftDaySDto p2, ShiftDay p3)
        {
            if (p2 == null)
            {
                return null;
            }
            ShiftDay result = p3 ?? new ShiftDay();
            
            result.DayOfWeek = p2.DayOfWeek;
            result.ShiftId = p2.ShiftId;
            result.Id = p2.Id;
            return result;
            
        }
        public static Expression<Func<ShiftDaySDto, ShiftDay>> ProjectToShiftDay => p4 => new ShiftDay()
        {
            DayOfWeek = p4.DayOfWeek,
            ShiftId = p4.ShiftId,
            Id = p4.Id
        };
        public static ShiftDaySDto AdaptToSDto(this ShiftDay p5)
        {
            return p5 == null ? null : new ShiftDaySDto()
            {
                DayOfWeek = p5.DayOfWeek,
                ShiftId = p5.ShiftId,
                Id = p5.Id
            };
        }
        public static ShiftDaySDto AdaptTo(this ShiftDay p6, ShiftDaySDto p7)
        {
            if (p6 == null)
            {
                return null;
            }
            ShiftDaySDto result = p7 ?? new ShiftDaySDto();
            
            result.DayOfWeek = p6.DayOfWeek;
            result.ShiftId = p6.ShiftId;
            result.Id = p6.Id;
            return result;
            
        }
        public static Expression<Func<ShiftDay, ShiftDaySDto>> ProjectToSDto => p8 => new ShiftDaySDto()
        {
            DayOfWeek = p8.DayOfWeek,
            ShiftId = p8.ShiftId,
            Id = p8.Id
        };
    }
}