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

namespace Brizco.Domain.Mappers
{
    public static partial class ShiftRoutineMapper
    {
        public static ShiftRoutine AdaptToShiftRoutine(this ShiftRoutineSDto p1)
        {
            return p1 == null ? null : new ShiftRoutine()
            {
                RoutineId = p1.RoutineId,
                ShiftId = p1.ShiftId,
                Id = p1.Id
            };
        }
        public static ShiftRoutine AdaptTo(this ShiftRoutineSDto p2, ShiftRoutine p3)
        {
            if (p2 == null)
            {
                return null;
            }
            ShiftRoutine result = p3 ?? new ShiftRoutine();
            
            result.RoutineId = p2.RoutineId;
            result.ShiftId = p2.ShiftId;
            result.Id = p2.Id;
            return result;
            
        }
        public static Expression<Func<ShiftRoutineSDto, ShiftRoutine>> ProjectToShiftRoutine => p4 => new ShiftRoutine()
        {
            RoutineId = p4.RoutineId,
            ShiftId = p4.ShiftId,
            Id = p4.Id
        };
        public static ShiftRoutineSDto AdaptToSDto(this ShiftRoutine p5)
        {
            return p5 == null ? null : new ShiftRoutineSDto()
            {
                RoutineId = p5.RoutineId,
                ShiftId = p5.ShiftId,
                Id = p5.Id
            };
        }
        public static ShiftRoutineSDto AdaptTo(this ShiftRoutine p6, ShiftRoutineSDto p7)
        {
            if (p6 == null)
            {
                return null;
            }
            ShiftRoutineSDto result = p7 ?? new ShiftRoutineSDto();
            
            result.RoutineId = p6.RoutineId;
            result.ShiftId = p6.ShiftId;
            result.Id = p6.Id;
            return result;
            
        }
        public static Expression<Func<ShiftRoutine, ShiftRoutineSDto>> ProjectToSDto => p8 => new ShiftRoutineSDto()
        {
            RoutineId = p8.RoutineId,
            ShiftId = p8.ShiftId,
            Id = p8.Id
        };
    }
}