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

namespace Brizco.Domain.Mappers
{
    public static partial class ShiftPlanUserMapper
    {
        public static ShiftPlanUser AdaptToShiftPlanUser(this ShiftPlanUserSDto p1)
        {
            return p1 == null ? null : new ShiftPlanUser()
            {
                ShiftPlanId = p1.ShiftPlanId,
                ApplicationUserId = p1.ApplicationUserId,
                Id = p1.Id
            };
        }
        public static ShiftPlanUser AdaptTo(this ShiftPlanUserSDto p2, ShiftPlanUser p3)
        {
            if (p2 == null)
            {
                return null;
            }
            ShiftPlanUser result = p3 ?? new ShiftPlanUser();
            
            result.ShiftPlanId = p2.ShiftPlanId;
            result.ApplicationUserId = p2.ApplicationUserId;
            result.Id = p2.Id;
            return result;
            
        }
        public static Expression<Func<ShiftPlanUserSDto, ShiftPlanUser>> ProjectToShiftPlanUser => p4 => new ShiftPlanUser()
        {
            ShiftPlanId = p4.ShiftPlanId,
            ApplicationUserId = p4.ApplicationUserId,
            Id = p4.Id
        };
        public static ShiftPlanUserSDto AdaptToSDto(this ShiftPlanUser p5)
        {
            return p5 == null ? null : new ShiftPlanUserSDto()
            {
                ShiftPlanId = p5.ShiftPlanId,
                ApplicationUserId = p5.ApplicationUserId,
                Id = p5.Id
            };
        }
        public static ShiftPlanUserSDto AdaptTo(this ShiftPlanUser p6, ShiftPlanUserSDto p7)
        {
            if (p6 == null)
            {
                return null;
            }
            ShiftPlanUserSDto result = p7 ?? new ShiftPlanUserSDto();
            
            result.ShiftPlanId = p6.ShiftPlanId;
            result.ApplicationUserId = p6.ApplicationUserId;
            result.Id = p6.Id;
            return result;
            
        }
        public static Expression<Func<ShiftPlanUser, ShiftPlanUserSDto>> ProjectToSDto => p8 => new ShiftPlanUserSDto()
        {
            ShiftPlanId = p8.ShiftPlanId,
            ApplicationUserId = p8.ApplicationUserId,
            Id = p8.Id
        };
    }
}