package com.ruoyi.dk.util;

import java.util.Random;

public class PhoneRandomUtil {

    public static final String CHINA = "china";
    public static final String YINDU = "yindu";

    public static String gen(String randomPhoneVersion) {
        if(CHINA.equals(randomPhoneVersion)){
            return genChina();
        }else if(YINDU.equals(randomPhoneVersion)){
            return genYindu();
        }
        return genChina();
    }

    public static String genYindu(){
        Random random = new Random();
        StringBuilder phoneNumber = new StringBuilder();
        phoneNumber.append("91");
        phoneNumber.append("******");
        for (int i = 0; i < 3; i++) {
            phoneNumber.append(random.nextInt(10));
        }
        return phoneNumber.toString();
    }

    public static String genChina(){
        Random random = new Random();
        StringBuilder phoneNumber = new StringBuilder();
        phoneNumber.append("1");
        for (int i = 0; i < 2; i++) {
            phoneNumber.append(random.nextInt(10));
        }
        phoneNumber.append("****");
        for (int i = 0; i < 4; i++) {
            phoneNumber.append(random.nextInt(10));
        }
        return phoneNumber.toString();
    }

}
