package cn.freemud.util;

import cn.freemud.request.ProductRandomVo;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;

public class ProductRandomUtil {
    private static final Map<String, String> map = new HashMap<String, String>() {
        {
            put("1","A");
            put("2","B");
            put("3","C");
            put("4","D");
            put("5","E");
            put("6","F");
            put("7","G");
            put("8","H");
            put("9","I");
            put("10","J");
            put("11","K");
            put("12","L");
            put("13","M");
            put("14","N");
            put("15","O");
            put("16","P");
            put("17","Q");
            put("18","R");
            put("19","S");
            put("20","T");
            put("21","U");
            put("22","V");
            put("23","W");
            put("24","X");
            put("25","Y");
            put("26","Z");
        }
    };

    public static ProductRandomVo getRandomProduct(String productId) {
        int r = Integer.valueOf(productId.substring(productId.length()-1));
        ProductRandomVo productRandomVo = new ProductRandomVo();
        productRandomVo.setId(String.valueOf(r+1));
        productRandomVo.setName(map.get(String.valueOf(r+1)));
        return productRandomVo;
    }
}
