import com.liquidnet.commons.lang.util.DESUtils;
import com.liquidnet.commons.lang.util.HttpUtil;
import com.liquidnet.commons.lang.util.IdentityUtils;
import lombok.SneakyThrows;
import org.junit.Test;

import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Scanner;

public class TestAdam {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int dbs = scanner.nextInt();
        String[] keys = {
                "adam:info:member:joinus:0",
                "adam:info:member:joinus:10",
                "adam:info:member:joinus:50",
                "adam:incr:member_no",
                "adam:ad:info",
                "adam:blacklist:member:uid",
                "adam:valid:sms:code:mobile18518013286",
                "adam:valid:sms:code:mobile18548596019",
                "adam:valid:sms:code:mobile17701223310",
                "adam:valid:sms:code:mobile13753596360",
                "adam:valid:sms:code:mobile15901093014",

                "adam:valid:sms:code:mobile15529282737",

                "adam:identity:mobile:13724286255",
                "adam:identity:mobile:15529282737",
                "adam:info:user:882883",
                "adam:info:morder:882883",
                "adam:info:umember:882883",
                "adam:info:real_name:882883",
                "adam:info:third_party:882883",
                "adam:info:enters:882883",
                "adam:info:addresses:882883",
                "adam:info:member:code:GMRGBUQB30",
                "adam:info:certification:1141181199209160192",

                "adam:identity:mobile:15529282737",
                "adam:identity:sso:882883",
                "adam:info:user:882883",
                "adam:morder:2283655",
                "adam:info:umember:1957341",
                "adam:info:morder:331587681810022407979836",

                "adam:info:member:simple",
                "adam:info:member:joinus",
                "adam:info:member:category:1",
                "adam:info:member:agreement",
                "adam:info:member:rights:1",
                "adam:info:member:price:1",
                "adam:info:member:rights:v:1",
                "adam:info:tags:music",
                "adam:info:tags:sex",
                "adam:info:morder:2292617",
                "adam:info:certification_junk:1510827199912020821",

                "candy:basic:coupon_code:0Jxko0wLWQdoTTF4",
                "candy:basic:coupon_code:MJIoHC2qVZ0lp9UI",
                "candy:basic:user_coupon:809406",
                "candy:basic:coupon_info:20210906143324612",
                "candy:basic:common_coupon",


                "sweet:manual:pushList",
        };
        for (String key : keys) {
            long value = key.hashCode();
            int idx = ((int) (value ^ (value >>> 32)) % dbs);
            System.out.printf("\n[%s] - idx:%s", key, idx);
        }
    }

    @Test
    public void test() {
        System.out.println(IdentityUtils.aliThird("徐佳颖", "429004200001202586"));
    }

    @SneakyThrows
    @Test
    public void testLoginBySilentMobile() {
        String mobile = "15811009011";
        String otp = DESUtils.DES().encrypt(mobile + LocalDateTime.now().toEpochSecond(ZoneOffset.UTC));
        String post = HttpUtil.post("http://testadam.zhengzai.tv/adam/login/silent_mobile?mobile=15811009011&otp=" + otp, null);
        System.out.println(post);
    }

    @Test
    public void testTmp() {

    }
}
