using API.Dto;
using Model;
using System.Collections.ObjectModel;
using System.Reflection.PortableExecutable;
using static System.Net.Mime.MediaTypeNames;
using System.Security.Claims;

namespace API.Mapping
{
    public static class ChampionMapper
    {
        public static ChampionDto ToDto(this Champion champion)
        {
            if (champion == null)
            {
                throw new ArgumentNullException("champion null");
            }

            return new ChampionDto
            {
                Name = champion.Name,  // je peux décider de mettre le nom en minuscule pour que le json est des noms en minuscule
                Bio = champion.Bio,
                Icon = champion.Icon,

                Keydic = champion.Characteristics.Keys,
                Valuedic = champion.Characteristics.Values,

                Class = champion.Class,
               // Skins = champion.Skins,
                //Skills = champion.Skills,
                Image = champion.Image
            };
        }
        public static Champion ToModel(this ChampionDto champion)
        {
            if (champion == null)
            {
                throw new ArgumentNullException("championDto null");
            }

            return new Champion(champion.Name, champion.Class, champion.Icon, champion.Image.Base64, champion.Bio);
        }
    }
}
