package com.iamberry.wechat.tools;


import org.omg.CORBA.INTERNAL;
import org.springframework.stereotype.Component;

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


@Component
public class PosterNumUtils {

    private PosterNumUtils(){
    }

    /**
     * 构造
     * @param type
     */
    public PosterNumUtils(Integer type){
        PosterNumUtils pnu = new PosterNumUtils();
        switch (type){
            case 1://头像在中间
                //二维码大小
                pnu.CODE_WIDTH = 106;
                pnu.CODE_HEIGHT = 106;
                //头像大小
                pnu.HEAD_WIDTH = 132;
                pnu.HEAD_HEIGHT = 132;
                pnu.HEAD_IS_CIRCLE = false;  //头像是否圆形

                /*文字位置 -- 昵称*/
                pnu.TEXT_X = -1; //居中
                pnu.TEXT_Y = 208;
                pnu.TEXT_FONT_SIZE = 30;

                /*文字位置 -- 文本 - 起始位置*/
                pnu.TEXT_CONTENT_X = 170; //居中
                pnu.TEXT_CONTENT_Y = 270;
                pnu.TEXT_CONTENT_FONT_SIZE = 26;

                /*每行文字字符限制数量,中文算两个字符，所以只能是双数*/
                pnu.FONT_NUMBER = 28;

                //每行间距 - 行距
                pnu.FONT_LINE_SPACING = 71;

                /*头像位置*/
                pnu.HEAD_X = 309;
                pnu.HEAD_Y = 38;

                /*二维码位置*/
                pnu.CODE_X = 620;
                pnu.CODE_Y = 1077;
                break;
            default://通用，传 0
                break;
        }
    }


    //背景色集合
    private static Map<Integer,String> map = new HashMap<>();

    public  String IMG_PATH = "common/images/movable/";
    public  String OLD_IMG_PATH = "common/images/movable/ditu.jpg";

    /*二维码大小*/
    public  int CODE_WIDTH = 144;
    public  int CODE_HEIGHT = 144;

    /*头像大小*/
    public  int HEAD_WIDTH = 124;
    public  int HEAD_HEIGHT = 124;
    public  boolean HEAD_IS_CIRCLE = false;  //头像是否圆形

    /*文字位置 -- 昵称*/
    public  int TEXT_X = 107; //居中
    public  int TEXT_Y = 243;
    public  int TEXT_FONT_SIZE = 20;

    /*文字位置 -- 文本 - 起始位置*/
    public  int TEXT_CONTENT_X = 170; //居中
    public  int TEXT_CONTENT_Y = 478;
    public  int TEXT_CONTENT_FONT_SIZE = 32;

    /*每行文字字符限制数量,中文算两个字符，所以只能是双数*/
    public  int FONT_NUMBER = 26;

    //每行间距 - 行距
    public  int FONT_LINE_SPACING = 48;

    /*头像位置*/
    public  int HEAD_X = 107;
    public  int HEAD_Y = 94;

    /*二维码位置*/
    public  int CODE_X = 490;
    public  int CODE_Y = 830;

    static {
        map.put(0,"head.jpg");  //默认头像
        map.put(1,"1.jpg");  //1号背景
        map.put(2,"2.jpg");  //2
        map.put(3,"3.jpg");  //3
        map.put(4,"4.jpg");  //4
        map.put(5,"5.jpg");  //5
    }
    public static String  getBackPath(Integer type){
        return "back/"+map.get(type);
    }


}
