package com.fs.wxwork;

import com.fs.wxwork.dto.*;
import com.fs.wxwork.service.WxWorkServiceImpl;

import java.util.Arrays;
import java.util.List;

public class test {
    static String uuid="f42e7267b93fa311037cc8e68b631e42";
    static String key="EBF75EAB917A32740FEADDDA6904CCA9";
    static String code="082963";

   static WxWorkServiceImpl wxWorkService = new WxWorkServiceImpl();
    public static void main(String[] args) {



            int i=3;
            switch (i) {
                case  1: init();
                    break;
                case  2: setCallbackUrl();
                    break;
                case  3: getQrCode();
                    break;
                case  4: CheckCode();
                    break;
                case  5:

                    Vid2UserId();
                    break;
                default:

            }




    }

    //初始化
    static  void  init(){
        WxWorkResponseDTO<WxWorkInitRespDTO> init = wxWorkService.init(new WxWorkInitDTO(),7L);
        WxWorkInitRespDTO data = init.getData();
        System.out.println(data);
    }

    static  void  Vid2UserId(){
        WxWorkVid2UserIdDTO wxWorkVid2UserIdDTO = new WxWorkVid2UserIdDTO();
        wxWorkVid2UserIdDTO.setUser_id(Arrays.asList(7881303019934662L));
        wxWorkVid2UserIdDTO.setUuid(uuid);
        WxWorkResponseDTO<List<WxWorkVid2UserIdRespDTO>> WxWorkVid2UserIdRespDTO = wxWorkService.Vid2UserId(wxWorkVid2UserIdDTO,7L);
        List<WxWorkVid2UserIdRespDTO> data = WxWorkVid2UserIdRespDTO.getData();
        System.out.println(data);
    }

    static  void  UserId2Vid(){
        WxWorkUserId2VidDTO wxWorkUserId2VidDTO = new WxWorkUserId2VidDTO();
        wxWorkUserId2VidDTO.setOpenid(Arrays.asList("wmotXidAAAXHhC7aTyEr5FmoxM2zq_bw"));
        wxWorkUserId2VidDTO.setUuid(uuid);
        WxWorkResponseDTO<List<WxWorkVid2UserIdRespDTO>> WxWorkVid2UserIdRespDTO = wxWorkService.UserId2Vid(wxWorkUserId2VidDTO,7L);
        List<WxWorkVid2UserIdRespDTO> data = WxWorkVid2UserIdRespDTO.getData();
        System.out.println(data);
    }

    static  void  sendMsg(String sz){
        WxWorkSendTextMsgDTO wxWorkSendTextMsgDTO = new WxWorkSendTextMsgDTO();
        wxWorkSendTextMsgDTO.setSend_userid(7881303019934662L);
        wxWorkSendTextMsgDTO.setUuid(uuid);
        wxWorkSendTextMsgDTO.setContent("你好啊"+sz);
        wxWorkSendTextMsgDTO.setIsRoom(false);
        WxWorkResponseDTO<WxWorkSendTextMsgRespDTO> wxWorkSendTextMsgRespDTOWxWorkResponseDTO = wxWorkService.SendTextMsg(wxWorkSendTextMsgDTO,7L);
        WxWorkSendTextMsgRespDTO data = wxWorkSendTextMsgRespDTOWxWorkResponseDTO.getData();


        System.out.println(data);
    }
    static  void  externalContacts(){
        WxwGetExternalContactsDTO wxwGetExternalContactsDTO = new WxwGetExternalContactsDTO();
        wxwGetExternalContactsDTO.setUuid(uuid);
        wxwGetExternalContactsDTO.setLimit(100);
        wxwGetExternalContactsDTO.setStrSeq("0");
        WxWorkResponseDTO<List<WxwGetExternalContactRespDTO>> externalContacts = wxWorkService.getExternalContacts(wxwGetExternalContactsDTO,7L);
        List<WxwGetExternalContactRespDTO> data = externalContacts.getData();

        System.out.println(data);
    }
    static  void  getRunClient(){
        WxWorkResponseDTO<WxwGetRunClientRespDTO> runClient = wxWorkService.getRunClient(7L);
        WxwGetRunClientRespDTO data = runClient.getData();
        System.out.println(data);
    }
    static  void  getQrCode(){
        WxWorkGetQrCodeDTO wxWorkGetQrCodeDTO = new WxWorkGetQrCodeDTO();
        wxWorkGetQrCodeDTO.setUuid(uuid);
        WxWorkResponseDTO<WxWorkGetQrCodeRespDTO> qrCode = wxWorkService.getQrCode(wxWorkGetQrCodeDTO,7L);
        WxWorkGetQrCodeRespDTO data = qrCode.getData();

        System.out.println(data.getKey());
        System.out.println(data.getQrcode());
    }
    static  void  CheckCode(){
        WxWorkCheckCodeDTO wxWorkCheckCodeDTO = new WxWorkCheckCodeDTO();
        wxWorkCheckCodeDTO.setUuid(uuid);
        wxWorkCheckCodeDTO.setCode(code);
        wxWorkCheckCodeDTO.setQrcodeKey(key);
        WxWorkResponseDTO wxWorkResponseDTO = wxWorkService.CheckCode(wxWorkCheckCodeDTO,7L);


        System.out.println(wxWorkResponseDTO);
    }
    static void setCallbackUrl(){
        WxWorkSetCallbackUrlDTO wxWorkSetCallbackUrlDTO = new WxWorkSetCallbackUrlDTO();
        wxWorkSetCallbackUrlDTO.setUrl("http://1.14.207.209:8008/msg/callback");
        wxWorkSetCallbackUrlDTO.setUuid(uuid);
        WxWorkResponseDTO wxWorkResponseDTO = wxWorkService.SetCallbackUrl(wxWorkSetCallbackUrlDTO,7L);
        System.out.println(wxWorkResponseDTO);
    }


    static void SecondaryValidation(){
        WxWorkGetQrCodeDTO wxWorkGetQrCodeDTO = new WxWorkGetQrCodeDTO();
        wxWorkGetQrCodeDTO.setUuid(uuid);
        wxWorkService.SecondaryValidation(wxWorkGetQrCodeDTO,1L);
        System.out.println(wxWorkGetQrCodeDTO);
    }

    static void getExternalContacts(){
        WxwGetExternalContactsDTO wxwGetExternalContactsDTO = new WxwGetExternalContactsDTO();
        wxwGetExternalContactsDTO.setUuid(uuid);
        WxWorkResponseDTO<List<WxwGetExternalContactRespDTO>> externalContacts = wxWorkService.getExternalContacts(wxwGetExternalContactsDTO,7L);
        System.out.println(externalContacts);
    }

}
