<commit_before>package no.stelar7.api.l4j8.impl;

import no.stelar7.api.l4j8.basic.constants.api.*;
import no.stelar7.api.l4j8.basic.constants.types.*;
import no.stelar7.api.l4j8.pojo.staticdata.champion.*;
import no.stelar7.api.l4j8.pojo.staticdata.item.Item;
import no.stelar7.api.l4j8.pojo.staticdata.mastery.StaticMastery;
import no.stelar7.api.l4j8.pojo.staticdata.realm.Realm;
import no.stelar7.api.l4j8.pojo.staticdata.rune.StaticRune;

import javax.annotation.Nullable;

public final class ImageAPI
{
    private static final ImageAPI INSTANCE = new ImageAPI();
    
    public static ImageAPI getInstance()
    {
        return ImageAPI.INSTANCE;
    }
    
    private ImageAPI()
    {
        // Hide public constructor
    }
    
    
    private String buildImageURL(@Nullable String version, String path, String file, @Nullable Platform rreg)
    {
        Platform region = rreg;
        if (region == null)
        {
            region = Platform.EUW1;
        }
        
        Realm  realm         = StaticAPI.getInstance().getRealm(region);
        String cdn           = realm.getCDN();
        String versionString = version != null ? version : realm.getV();
        
        return cdn + Constants.SEPARATOR + versionString + Constants.SEPARATOR + path + Constants.SEPARATOR + file;
    }
    
    
    /**
     * Gets profile icon.
     *
     * @param iconid  the iconid
     * @param version the version
     * @return the profile icon
     */
    public String getProfileIcon(String iconid, @Nullable String version, @Nullable Platform region)
    {
        //http://ddragon.leagueoflegends.com/cdn/6.24.1/img/profileicon/588.png
        return buildImageURL(version, "img/profileicon", iconid + ".png", region);
    }
    
    /**
     * Gets profile icon.
     *
     * @param region       the region
     * @param summonerName the summoner name
     * @return the profile icon
     */
    public String getProfileIcon(Platform region, String summonerName)
    {
        // http://avatar.leagueoflegends.com/region/summonername.png
        return "http://avatar.leagueoflegends.com/" + region.toString() + Constants.SEPARATOR + summonerName + ".png";
    }
    
    /**
     * Gets splash art.
     *
     * @param championId the champion id
     * @param skinNum    the skin num
     * @return the splash art
     */
    public String getSplashArt(String championId, int skinNum, @Nullable Platform region)
    {
        // http://ddragon.leagueoflegends.com/cdn/img/champion/splash/Aatrox_0.jpg
        return buildImageURL(null, "img/champion/splash", championId + "_" + skinNum + ".png", region);
    }
    
    /**
     * Gets splash art.
     *
     * @param skin the skin
     * @return the splash art
     */
    public String getSplashArt(Skin skin, @Nullable Platform region)
    {
        // http://ddragon.leagueoflegends.com/cdn/img/champion/splash/Aatrox_0.jpg
        return buildImageURL(null, "img/champion/splash", skin.getId() + "_" + skin.getNum() + ".png", region);
    }
    
    /**
     * Gets loading screen art.
     *
     * @param championId the champion id
     * @param skinNum    the skin num
     * @return the loading screen art
     */
    public String getLoadingScreenArt(String championId, int skinNum, @Nullable Platform region)
    {
        // http://ddragon.leagueoflegends.com/cdn/img/champion/loading/Aatrox_0.jpg
        return buildImageURL(null, "img/champion/loading", championId + "_" + skinNum + ".png", region);
    }
    
    /**
     * Gets loading screen art.
     *
     * @param skin the skin
     * @return the loading screen art
     */
    public String getLoadingScreenArt(Skin skin, @Nullable Platform region)
    {
        // http://ddragon.leagueoflegends.com/cdn/img/champion/loading/Aatrox_0.jpg
        return buildImageURL(null, "img/champion/loading", skin.getId() + "_" + skin.getNum() + ".png", region);
    }
    
    
    /**
     * Gets square.
     *
     * @param champ   the champ
     * @param version the version
     * @return the square
     */
    public String getSquare(StaticChampion champ, @Nullable String version, @Nullable Platform region)
    {
        // http://ddragon.leagueoflegends.com/cdn/6.24.1/img/champion/Aatrox.png
        return buildImageURL(version, "img/champion", champ.getImage().getFull(), region);
    }
    
    /**
     * Gets square.
     *
     * @param champKey the champ key
     * @param version  the version
     * @return the square
     */
    public String getSquare(String champKey, @Nullable String version, @Nullable Platform region)
    {
        // http://ddragon.leagueoflegends.com/cdn/6.24.1/img/champion/Aatrox.png
        return buildImageURL(version, "img/champion", champKey + ".png", region);
    }
    
    /**
     * Gets passive.
     *
     * @param passiveId the passive id
     * @param version   the version
     * @return the passive
     */
    public String getPassive(String passiveId, @Nullable String version, @Nullable Platform region)
    {
        // http://ddragon.leagueoflegends.com/cdn/6.24.1/img/passive/Anivia_P.png
        return buildImageURL(version, "img/passive", passiveId + ".png", region);
    }
    
    /**
     * Gets passive.
     *
     * @param passive the passive
     * @param version the version
     * @return the passive
     */
    public String getPassive(Passive passive, @Nullable String version, @Nullable Platform region)
    {
        // http://ddragon.leagueoflegends.com/cdn/6.24.1/img/passive/Anivia_P.png
        return buildImageURL(version, "img/passive", passive.getImage().getFull(), region);
    }
    
    /**
     * Gets ability.
     *
     * @param spell   the spell
     * @param version the version
     * @return the ability
     */
    public String getAbility(StaticChampionSpell spell, @Nullable String version, @Nullable Platform region)
    {
        //  http://ddragon.leagueoflegends.com/cdn/6.24.1/img/spell/FlashFrost.png
        return buildImageURL(version, "img/spell", spell.getImage().getFull(), region);
    }
    
    /**
     * Gets ability.
     *
     * @param imageFull the spell.getImage().getFull()
     * @param version   the version
     * @return the ability
     */
    public String getAbility(String imageFull, @Nullable String version, @Nullable Platform region)
    {
        //  http://ddragon.leagueoflegends.com/cdn/6.24.1/img/spell/FlashFrost.png
        return buildImageURL(version, "img/spell", imageFull, region);
    }
    
    /**
     * Gets summoner spell.
     *
     * @param spell   the spell
     * @param version the version<commit_msg>Add string version to getPassive<commit_after>package no.stelar7.api.l4j8.impl;

import no.stelar7.api.l4j8.basic.constants.api.*;
import no.stelar7.api.l4j8.basic.constants.types.*;
import no.stelar7.api.l4j8.pojo.staticdata.champion.*;
import no.stelar7.api.l4j8.pojo.staticdata.item.Item;
import no.stelar7.api.l4j8.pojo.staticdata.mastery.StaticMastery;
import no.stelar7.api.l4j8.pojo.staticdata.realm.Realm;
import no.stelar7.api.l4j8.pojo.staticdata.rune.StaticRune;

import javax.annotation.Nullable;

public final class ImageAPI
{
    private static final ImageAPI INSTANCE = new ImageAPI();
    
    public static ImageAPI getInstance()
    {
        return ImageAPI.INSTANCE;
    }
    
    private ImageAPI()
    {
        // Hide public constructor
    }
    
    
    private String buildImageURL(@Nullable String version, String path, String file, @Nullable Platform rreg)
    {
        Platform region = rreg;
        if (region == null)
        {
            region = Platform.EUW1;
        }
        
        Realm  realm         = StaticAPI.getInstance().getRealm(region);
        String cdn           = realm.getCDN();
        String versionString = version != null ? version : realm.getV();
        
        return cdn + Constants.SEPARATOR + versionString + Constants.SEPARATOR + path + Constants.SEPARATOR + file;
    }
    
    
    /**
     * Gets profile icon.
     *
     * @param iconid  the iconid
     * @param version the version
     * @return the profile icon
     */
    public String getProfileIcon(String iconid, @Nullable String version, @Nullable Platform region)
    {
        //http://ddragon.leagueoflegends.com/cdn/6.24.1/img/profileicon/588.png
        return buildImageURL(version, "img/profileicon", iconid + ".png", region);
    }
    
    /**
     * Gets profile icon.
     *
     * @param region       the region
     * @param summonerName the summoner name
     * @return the profile icon
     */
    public String getProfileIcon(Platform region, String summonerName)
    {
        // http://avatar.leagueoflegends.com/region/summonername.png
        return "http://avatar.leagueoflegends.com/" + region.toString() + Constants.SEPARATOR + summonerName + ".png";
    }
    
    /**
     * Gets splash art.
     *
     * @param championId the champion id
     * @param skinNum    the skin num
     * @return the splash art
     */
    public String getSplashArt(String championId, int skinNum, @Nullable Platform region)
    {
        // http://ddragon.leagueoflegends.com/cdn/img/champion/splash/Aatrox_0.jpg
        return buildImageURL(null, "img/champion/splash", championId + "_" + skinNum + ".png", region);
    }
    
    /**
     * Gets splash art.
     *
     * @param skin the skin
     * @return the splash art
     */
    public String getSplashArt(Skin skin, @Nullable Platform region)
    {
        // http://ddragon.leagueoflegends.com/cdn/img/champion/splash/Aatrox_0.jpg
        return buildImageURL(null, "img/champion/splash", skin.getId() + "_" + skin.getNum() + ".png", region);
    }
    
    /**
     * Gets loading screen art.
     *
     * @param championId the champion id
     * @param skinNum    the skin num
     * @return the loading screen art
     */
    public String getLoadingScreenArt(String championId, int skinNum, @Nullable Platform region)
    {
        // http://ddragon.leagueoflegends.com/cdn/img/champion/loading/Aatrox_0.jpg
        return buildImageURL(null, "img/champion/loading", championId + "_" + skinNum + ".png", region);
    }
    
    /**
     * Gets loading screen art.
     *
     * @param skin the skin
     * @return the loading screen art
     */
    public String getLoadingScreenArt(Skin skin, @Nullable Platform region)
    {
        // http://ddragon.leagueoflegends.com/cdn/img/champion/loading/Aatrox_0.jpg
        return buildImageURL(null, "img/champion/loading", skin.getId() + "_" + skin.getNum() + ".png", region);
    }
    
    
    /**
     * Gets square.
     *
     * @param champ   the champ
     * @param version the version
     * @return the square
     */
    public String getSquare(StaticChampion champ, @Nullable String version, @Nullable Platform region)
    {
        // http://ddragon.leagueoflegends.com/cdn/6.24.1/img/champion/Aatrox.png
        return buildImageURL(version, "img/champion", champ.getImage().getFull(), region);
    }
    
    /**
     * Gets square.
     *
     * @param champKey the champ key
     * @param version  the version
     * @return the square
     */
    public String getSquare(String champKey, @Nullable String version, @Nullable Platform region)
    {
        // http://ddragon.leagueoflegends.com/cdn/6.24.1/img/champion/Aatrox.png
        return buildImageURL(version, "img/champion", champKey + ".png", region);
    }
    
    
    /**
     * Gets ability.
     *
     * @param imageFull the spell.getImage().getFull()
     * @param version   the version
     * @return the ability
     */
    public String getPassive(String imageFull, @Nullable String version, @Nullable Platform region)
    {
        // http://ddragon.leagueoflegends.com/cdn/6.24.1/img/passive/Anivia_P.png
        return buildImageURL(version, "img/passive", imageFull, region);
    }
    
    /**
     * Gets passive.
     *
     * @param passive the passive
     * @param version the version
     * @return the passive
     */
    public String getPassive(Passive passive, @Nullable String version, @Nullable Platform region)
    {
        // http://ddragon.leagueoflegends.com/cdn/6.24.1/img/passive/Anivia_P.png
        return buildImageURL(version, "img/passive", passive.getImage().getFull(), region);
    }
    
    /**
     * Gets ability.
     *
     * @param spell   the spell
     * @param version the version
     * @return the ability
     */
    public String getAbility(StaticChampionSpell spell, @Nullable String version, @Nullable Platform region)
    {
        //  http://ddragon.leagueoflegends.com/cdn/6.24.1/img/spell/FlashFrost.png
        return buildImageURL(version, "img/spell", spell.getImage().getFull(), region);
    }
    
    /**
     * Gets ability.
     *
     * @param imageFull the spell.getImage().getFull()
     * @param version   the version
     * @return the ability
     */
    public String getAbility(String imageFull, @Nullable String version, @Nullable Platform region)
    {
        //  http://ddragon.leagueoflegends.com/cdn/6.24.1/img/spell/FlashFrost.png
        return buildImageURL(version, "img/spell", imageFull, region);
    }
    
    /**
     * Gets summoner spell.
     *
     * @param spell   the spell
     * @param version the version
{'fraction_non_alphanumeric': 0.11642129105322763, 'fraction_numerical': 0.009060022650056626, 'mean_word_length': 2.344949494949495, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '974812', 'n_tokens_mistral': 4180, 'n_tokens_neox': 4143, 'n_words': 909}