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

namespace Brizco.Domain.Mappers
{
    public static partial class TaskRoleMapper
    {
        public static TaskRole AdaptToTaskRole(this TaskRoleSDto p1)
        {
            return p1 == null ? null : new TaskRole()
            {
                RoleId = p1.RoleId,
                TaskId = p1.TaskId,
                Id = p1.Id
            };
        }
        public static TaskRole AdaptTo(this TaskRoleSDto p2, TaskRole p3)
        {
            if (p2 == null)
            {
                return null;
            }
            TaskRole result = p3 ?? new TaskRole();
            
            result.RoleId = p2.RoleId;
            result.TaskId = p2.TaskId;
            result.Id = p2.Id;
            return result;
            
        }
        public static Expression<Func<TaskRoleSDto, TaskRole>> ProjectToTaskRole => p4 => new TaskRole()
        {
            RoleId = p4.RoleId,
            TaskId = p4.TaskId,
            Id = p4.Id
        };
        public static TaskRoleSDto AdaptToSDto(this TaskRole p5)
        {
            return p5 == null ? null : new TaskRoleSDto()
            {
                RoleId = p5.RoleId,
                TaskId = p5.TaskId,
                Id = p5.Id
            };
        }
        public static TaskRoleSDto AdaptTo(this TaskRole p6, TaskRoleSDto p7)
        {
            if (p6 == null)
            {
                return null;
            }
            TaskRoleSDto result = p7 ?? new TaskRoleSDto();
            
            result.RoleId = p6.RoleId;
            result.TaskId = p6.TaskId;
            result.Id = p6.Id;
            return result;
            
        }
        public static Expression<Func<TaskRole, TaskRoleSDto>> ProjectToSDto => p8 => new TaskRoleSDto()
        {
            RoleId = p8.RoleId,
            TaskId = p8.TaskId,
            Id = p8.Id
        };
    }
}