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

namespace Brizco.Domain.Mappers
{
    public static partial class TaskDayMapper
    {
        public static TaskDay AdaptToTaskDay(this TaskDaySDto p1)
        {
            return p1 == null ? null : new TaskDay()
            {
                DayOfWeek = p1.DayOfWeek,
                TaskId = p1.TaskId,
                Id = p1.Id
            };
        }
        public static TaskDay AdaptTo(this TaskDaySDto p2, TaskDay p3)
        {
            if (p2 == null)
            {
                return null;
            }
            TaskDay result = p3 ?? new TaskDay();
            
            result.DayOfWeek = p2.DayOfWeek;
            result.TaskId = p2.TaskId;
            result.Id = p2.Id;
            return result;
            
        }
        public static Expression<Func<TaskDaySDto, TaskDay>> ProjectToTaskDay => p4 => new TaskDay()
        {
            DayOfWeek = p4.DayOfWeek,
            TaskId = p4.TaskId,
            Id = p4.Id
        };
        public static TaskDaySDto AdaptToSDto(this TaskDay p5)
        {
            return p5 == null ? null : new TaskDaySDto()
            {
                DayOfWeek = p5.DayOfWeek,
                TaskId = p5.TaskId,
                Id = p5.Id
            };
        }
        public static TaskDaySDto AdaptTo(this TaskDay p6, TaskDaySDto p7)
        {
            if (p6 == null)
            {
                return null;
            }
            TaskDaySDto result = p7 ?? new TaskDaySDto();
            
            result.DayOfWeek = p6.DayOfWeek;
            result.TaskId = p6.TaskId;
            result.Id = p6.Id;
            return result;
            
        }
        public static Expression<Func<TaskDay, TaskDaySDto>> ProjectToSDto => p8 => new TaskDaySDto()
        {
            DayOfWeek = p8.DayOfWeek,
            TaskId = p8.TaskId,
            Id = p8.Id
        };
    }
}