using API.Dto;
using Model;

namespace API.Mapping
{
    public static class SkinMapper
    {

        public static SkinDto ToDto(this Skin skin)
        {
            if (skin == null)
            {
                throw new ArgumentNullException("Skin null");
            }

            return new SkinDto()
            {
                Name = skin.Name,
                Champion = skin.Champion.ToDto(),
                Description = skin.Description,
                Price = skin.Price,
                Icon = skin.Icon,
                Image = skin.Image
            };
        }

        public static Skin ToSkin(this SkinDto skinDto)
        {
            if (skinDto == null)
            {
                throw new ArgumentNullException("SkinDto null");
            }

            return new Skin(skinDto.Name, skinDto.Champion.ToModel(), skinDto.Price, skinDto.Icon, skinDto.Image.Base64, skinDto.Description);
        }
    }
}
