package com.example.math.controller;


import com.alibaba.fastjson2.JSONObject;
import com.example.math.mqtt.SendMsg;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.*;


/**
 * demo mqtt send receive
 */


@RestController
@RequestMapping(path="/example")
public class ExampleController {


    @GetMapping("/v1/access")
    public String access() {

        System.out.println("enter access123 timstamp is [" + System.currentTimeMillis() + "].");
        return "finish...";
    }

//    public static void main(String[] args) {
//        Map<String,Object> credentials = new HashMap<>();
//        credentials.put("access_key_id" ,"STS.NSpXAi8To2Yb6EoH2XEFgxZ37");
//        credentials.put("access_key_secret" ,"BRG6pmgRr5rQ2je164881vsZLVfLp1kr7vtES5KWSNj5");
//        credentials.put("expire" ,3600);
//        credentials.put("security_token" ,"CAIS8AJ1q6Ft5B2yfSjIr5DFE/vd1YtOhZuJNGPerDINSclLl5+Y1Tz2IHBPenVqA+Efsfoym2BU7PYalqJIRoReREvCUcZr8sz6ZLsAh9CT1fau5Jko1be0ewHKeQKZsebWZ+LmNpy/Ht6md1HDkAJq3LL+bk/Mdle5MJqP+/kFC9MMRVuAcCZhDtVbLRcYgq18D3bKMuu3ORPHm3fZCFES2jBxkmRi86+ysIP+phPVlw/90fRH5dazcIStKtVhN5c6UtK80+Exd6/I3yNc6gINtoUO1fcVqGic5YDEXwgMv0XbbdC5qIM/cFVLAYEhALNBofTGkvl1h/fejYyfyWwWbboLD36FFdn/npabSL/zZo4jF6zyPnPWycyCLYXlM7PTn9XS4mmgEvhWyR8YYXREIlmyof91cNNTFEzqzSTRZSvSfU7pK/nMvLvsaRHGCP7imk1TMeRnBGgjbCUN1leKH8FLDUoiOj0ICd6hgSZoMng2wRqAASqOBZnJmcA4+fb4OuIztj0Ne4IQTB+Id8Vo9jMoiw1gD7ZZmW45q2riU54LRZ8oS5jA92DXCVy4C+iGYpPxHLtaBmxiWlMd+8hwvD3brxAcRr5nBVbINra/SsQvpFNbyd3F1BVLtjoR6dMsq2xIvL28/VOKSA4raa7Kf3PgAApUIAA=");
//
//
//        Map<String,Object> outputItem = new HashMap<>();
//        outputItem.put("bucket" ,"hyslj-dev");
//        outputItem.put("endpoint" ,"https://oss-cn-shanghai.aliyuncs.com");
//        outputItem.put("object_key_prefix" ,"b4cfaae6-bd9d-4cd0-8472-63b608c3c581");
//        outputItem.put("provider" ,"ali");
//        outputItem.put("region" ,"sh");
//        outputItem.put("credentials" ,credentials);
//
//        Map<String,Object> data = new HashMap<>();
//        data.put("output",outputItem);
//        data.put("result",0);
//
//        Map<String,Object> content = new HashMap<>();
//        content.put("tid","123");
//        content.put("bid","456");
//        content.put("timestamp",System.currentTimeMillis());
//        content.put("method","storage_config_get");
//        content.put("data",data);
//
//        String msg = JSONObject.toJSONString(content);
////                log.info("will send msg is {}" ,msg);
//
//        System.out.println(msg);
//    }



}