using AutoMapper;
using DataAccessLayer.Entities;
using DataAccessLayer.Filtering;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WcfServices.Dto;

namespace WcfServices.Mapping
{
    public static class AutoMapperHelper
    {
        public static readonly MapperConfiguration Config = new MapperConfiguration(cfg =>
        {
            cfg.CreateMap<AttendanceEventType, AttendanceEventTypeDto>();
            cfg.CreateMap<AttendanceEventTypeDto, AttendanceEventType>();

            cfg.CreateMap<AttendanceRecord, AttendanceRecordDto>();
            cfg.CreateMap<AttendanceRecordDto, AttendanceRecord>();

            cfg.CreateMap<Department, DepartmentDto>();
            cfg.CreateMap<DepartmentDto, Department>();

            cfg.CreateMap<Employee, EmployeeDto>();
            cfg.CreateMap<EmployeeDto, Employee>();

            cfg.CreateMap<EmployeePosition, EmployeePositionDto>();
            cfg.CreateMap<EmployeePositionDto, EmployeePosition>();

            cfg.CreateMap<Filter, FilterDto>();
            cfg.CreateMap<FilterDto, Filter>();

            cfg.CreateMap<PersonalEvent, PersonalEventDto>();
            cfg.CreateMap<PersonalEventDto, PersonalEvent>();

            cfg.CreateMap<PersonalEventType, PersonalEventTypeDto>();
            cfg.CreateMap<PersonalEventTypeDto, PersonalEventType>();

            cfg.CreateMap<Project, ProjectDto>();
            cfg.CreateMap<ProjectDto, Project>();

            cfg.CreateMap<Role, RoleDto>();
            cfg.CreateMap<RoleDto, Role>();

            cfg.CreateMap<TimeSheetRecord, TimeSheetRecordDto>();
            cfg.CreateMap<TimeSheetRecordDto, TimeSheetRecord>();

            cfg.CreateMap<User, UserDto>().ForMember(dto => dto.UserRoles, opt => opt.MapFrom(x => x.Roles));
            cfg.CreateMap<UserDto, User>();

            cfg.CreateMap<Request, RequestDto>();
            cfg.CreateMap<RequestDto, Request>();

        });
    }
}
