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

namespace Brizco.Domain.Mappers
{
    public static partial class TaskUserMapper
    {
        public static TaskUser AdaptToTaskUser(this TaskUserSDto p1)
        {
            return p1 == null ? null : new TaskUser()
            {
                UserId = p1.UserId,
                TaskId = p1.TaskId
            };
        }
        public static TaskUser AdaptTo(this TaskUserSDto p2, TaskUser p3)
        {
            if (p2 == null)
            {
                return null;
            }
            TaskUser result = p3 ?? new TaskUser();
            
            result.UserId = p2.UserId;
            result.TaskId = p2.TaskId;
            return result;
            
        }
        public static Expression<Func<TaskUserSDto, TaskUser>> ProjectToTaskUser => p4 => new TaskUser()
        {
            UserId = p4.UserId,
            TaskId = p4.TaskId
        };
        public static TaskUserSDto AdaptToSDto(this TaskUser p5)
        {
            return p5 == null ? null : new TaskUserSDto()
            {
                UserId = p5.UserId,
                TaskId = p5.TaskId
            };
        }
        public static TaskUserSDto AdaptTo(this TaskUser p6, TaskUserSDto p7)
        {
            if (p6 == null)
            {
                return null;
            }
            TaskUserSDto result = p7 ?? new TaskUserSDto();
            
            result.UserId = p6.UserId;
            result.TaskId = p6.TaskId;
            return result;
            
        }
        public static Expression<Func<TaskUser, TaskUserSDto>> ProjectToSDto => p8 => new TaskUserSDto()
        {
            UserId = p8.UserId,
            TaskId = p8.TaskId
        };
    }
}