using EFlib;
using Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EFMapping
{
    public static class EFCharacteristicsMapper
    {
        public static EFCharacteristics toEF(this KeyValuePair<string, int> item, EFChampion champion, SQLiteContext context)
        {
            var EfCharacteristics = context.Characteristics.Find(item.Key, champion.Name);
            if (EfCharacteristics == null)
            {
                return new()
                {
                    Name = item.Key,
                    Value = item.Value,
                    NameChampion = champion.Name
                };
            }
            return EfCharacteristics;
        }

        public static Tuple<string, int> toModel(this EFCharacteristics Charac)=> new(Charac.Name, Charac.Value);

    }
}
