using AutoMapper;
using Lada.Framework.Data.Domains;
using Ladaer.BackEnd.Infrastructures.DTO.Items.AppConfig;
using Ladaer.BackEnd.Infrastructures.DTO.Models.AppConfig;

namespace Ladaer.BackEnd.Infrastructures.DTO.Profiles
{
    public class AppConfigMappingProfile : Profile
    {
        public AppConfigMappingProfile()
        {
            #region AppConfig
            CreateMap<AppConfig, AppConfigItem>();
            CreateMap<AppConfig, CreateAppConfigModel>();
            CreateMap<CreateAppConfigModel, AppConfig>();
            #endregion
        }
    }

    public static class AppConfigMappingExtensions
    {
        // AppConfig extensions
        public static AppConfigItem ToItem(this AppConfig entity)
            => entity.MapTo<AppConfig, AppConfigItem>();

        public static CreateAppConfigModel ToModel(this AppConfig entity)
            => entity.MapTo<AppConfig, CreateAppConfigModel>();

        public static AppConfig ToEntity(this CreateAppConfigModel model)
            => model.MapTo<CreateAppConfigModel, AppConfig>();
    }
}