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

namespace Brizco.Domain.Mappers
{
    public static partial class ComplexUserMapper
    {
        public static ComplexUser AdaptToComplexUser(this ComplexUserSDto p1)
        {
            return p1 == null ? null : new ComplexUser()
            {
                UserId = p1.UserId,
                ComplexId = p1.ComplexId,
                Id = p1.Id
            };
        }
        public static ComplexUser AdaptTo(this ComplexUserSDto p2, ComplexUser p3)
        {
            if (p2 == null)
            {
                return null;
            }
            ComplexUser result = p3 ?? new ComplexUser();
            
            result.UserId = p2.UserId;
            result.ComplexId = p2.ComplexId;
            result.Id = p2.Id;
            return result;
            
        }
        public static Expression<Func<ComplexUserSDto, ComplexUser>> ProjectToComplexUser => p4 => new ComplexUser()
        {
            UserId = p4.UserId,
            ComplexId = p4.ComplexId,
            Id = p4.Id
        };
        public static ComplexUserSDto AdaptToSDto(this ComplexUser p5)
        {
            return p5 == null ? null : new ComplexUserSDto()
            {
                UserId = p5.UserId,
                ComplexId = p5.ComplexId,
                Id = p5.Id
            };
        }
        public static ComplexUserSDto AdaptTo(this ComplexUser p6, ComplexUserSDto p7)
        {
            if (p6 == null)
            {
                return null;
            }
            ComplexUserSDto result = p7 ?? new ComplexUserSDto();
            
            result.UserId = p6.UserId;
            result.ComplexId = p6.ComplexId;
            result.Id = p6.Id;
            return result;
            
        }
        public static Expression<Func<ComplexUser, ComplexUserSDto>> ProjectToSDto => p8 => new ComplexUserSDto()
        {
            UserId = p8.UserId,
            ComplexId = p8.ComplexId,
            Id = p8.Id
        };
    }
}