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

namespace Brizco.Domain.Mappers
{
    public static partial class ComplexUserRoleMapper
    {
        public static ComplexUserRole AdaptToComplexUserRole(this ComplexUserRoleSDto p1)
        {
            return p1 == null ? null : new ComplexUserRole()
            {
                ComplexUserId = p1.ComplexUserId,
                RoleId = p1.RoleId,
                Id = p1.Id
            };
        }
        public static ComplexUserRole AdaptTo(this ComplexUserRoleSDto p2, ComplexUserRole p3)
        {
            if (p2 == null)
            {
                return null;
            }
            ComplexUserRole result = p3 ?? new ComplexUserRole();
            
            result.ComplexUserId = p2.ComplexUserId;
            result.RoleId = p2.RoleId;
            result.Id = p2.Id;
            return result;
            
        }
        public static Expression<Func<ComplexUserRoleSDto, ComplexUserRole>> ProjectToComplexUserRole => p4 => new ComplexUserRole()
        {
            ComplexUserId = p4.ComplexUserId,
            RoleId = p4.RoleId,
            Id = p4.Id
        };
        public static ComplexUserRoleSDto AdaptToSDto(this ComplexUserRole p5)
        {
            return p5 == null ? null : new ComplexUserRoleSDto()
            {
                RoleId = p5.RoleId,
                ComplexUserId = p5.ComplexUserId,
                Id = p5.Id
            };
        }
        public static ComplexUserRoleSDto AdaptTo(this ComplexUserRole p6, ComplexUserRoleSDto p7)
        {
            if (p6 == null)
            {
                return null;
            }
            ComplexUserRoleSDto result = p7 ?? new ComplexUserRoleSDto();
            
            result.RoleId = p6.RoleId;
            result.ComplexUserId = p6.ComplexUserId;
            result.Id = p6.Id;
            return result;
            
        }
        public static Expression<Func<ComplexUserRole, ComplexUserRoleSDto>> ProjectToSDto => p8 => new ComplexUserRoleSDto()
        {
            RoleId = p8.RoleId,
            ComplexUserId = p8.ComplexUserId,
            Id = p8.Id
        };
    }
}