using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.DataLayer.Entities;

namespace WorkFlowCheck.MAUI.Mapper
{
    public class MapperProfile:Profile
    {
        public MapperProfile()
        {
            CreateMap<CheckPoint, CheckPointDTO>().ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRows));
            CreateMap<CheckPointDTO, CheckPoint>();

            CreateMap<CheckListTemplateHeaderDTO, CheckListTemplateHeader>()
                .ForMember(dest => dest.CheckListTemplateRows, opt => opt.MapFrom(src => src.CheckListTemplateRowDTO));
            CreateMap<CheckListTemplateHeader, CheckListTemplateHeaderDTO>()
                .ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRows));
            CreateMap<CheckListTemplateRow, CheckListTemplateRowDTO>();
            CreateMap<CheckListTemplateRowDTO, CheckListTemplateRow>();

            CreateMap<CheckListHeader, CheckListHeaderDTO>()
                .ForMember(dest => dest.CheckListRowDTO, opt => opt.MapFrom(src => src.CheckListRows));
            CreateMap<CheckListHeaderDTO, CheckListHeader>()
                .ForMember(dest => dest.CheckListRows, opt => opt.MapFrom(src => src.CheckListRowDTO));
            CreateMap<CheckListRow, CheckListRowDTO>()
                .ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRow));
            CreateMap<CheckListRowDTO, CheckListRow>()
                .ForMember(dest => dest.CheckListTemplateRow, opt => opt.MapFrom(src => src.CheckListTemplateRowDTO)); 
        }
    }
}
