using System;
using System.Linq.Expressions;
using DocuMed.Domain.Dtos.SmallDtos;
using DocuMed.Domain.Entities.City;

namespace DocuMed.Domain.Mappers
{
    public static partial class SectionMapper
    {
        public static Section AdaptToSection(this SectionSDto p1)
        {
            return p1 == null ? null : new Section()
            {
                Name = p1.Name,
                Detail = p1.Detail,
                UniversityId = p1.UniversityId,
                Id = p1.Id
            };
        }
        public static Section AdaptTo(this SectionSDto p2, Section p3)
        {
            if (p2 == null)
            {
                return null;
            }
            Section result = p3 ?? new Section();
            
            result.Name = p2.Name;
            result.Detail = p2.Detail;
            result.UniversityId = p2.UniversityId;
            result.Id = p2.Id;
            return result;
            
        }
        public static Expression<Func<SectionSDto, Section>> ProjectToSection => p4 => new Section()
        {
            Name = p4.Name,
            Detail = p4.Detail,
            UniversityId = p4.UniversityId,
            Id = p4.Id
        };
        public static SectionSDto AdaptToSDto(this Section p5)
        {
            return p5 == null ? null : new SectionSDto()
            {
                Name = p5.Name,
                Detail = p5.Detail,
                UniversityId = p5.UniversityId,
                Id = p5.Id
            };
        }
        public static SectionSDto AdaptTo(this Section p6, SectionSDto p7)
        {
            if (p6 == null)
            {
                return null;
            }
            SectionSDto result = p7 ?? new SectionSDto();
            
            result.Name = p6.Name;
            result.Detail = p6.Detail;
            result.UniversityId = p6.UniversityId;
            result.Id = p6.Id;
            return result;
            
        }
        public static Expression<Func<Section, SectionSDto>> ProjectToSDto => p8 => new SectionSDto()
        {
            Name = p8.Name,
            Detail = p8.Detail,
            UniversityId = p8.UniversityId,
            Id = p8.Id
        };
    }
}