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,
                PositionId = p1.PositionId,
                UserId = p1.UserId,
                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.PositionId = p2.PositionId;
            result.UserId = p2.UserId;
            result.Id = p2.Id;
            return result;
            
        }
        public static Expression<Func<ShiftPlanUserSDto, ShiftPlanUser>> ProjectToShiftPlanUser => p4 => new ShiftPlanUser()
        {
            ShiftPlanId = p4.ShiftPlanId,
            PositionId = p4.PositionId,
            UserId = p4.UserId,
            Id = p4.Id
        };
        public static ShiftPlanUserSDto AdaptToSDto(this ShiftPlanUser p5)
        {
            return p5 == null ? null : new ShiftPlanUserSDto()
            {
                ShiftPlanId = p5.ShiftPlanId,
                UserId = p5.UserId,
                PositionId = p5.PositionId,
                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.UserId = p6.UserId;
            result.PositionId = p6.PositionId;
            result.Id = p6.Id;
            return result;
            
        }
        public static Expression<Func<ShiftPlanUser, ShiftPlanUserSDto>> ProjectToSDto => p8 => new ShiftPlanUserSDto()
        {
            ShiftPlanId = p8.ShiftPlanId,
            UserId = p8.UserId,
            PositionId = p8.PositionId,
            Id = p8.Id
        };
    }
}