package com.emoon.openplatform.client;

import cn.hutool.core.lang.UUID;
import cn.hutool.json.JSONUtil;
import com.emoon.common.core.domain.R;
import com.emoon.common.httpclient.AdminClient;
import com.emoon.common.httpclient.domain.AdminLoginRequest;
import com.emoon.common.httpclient.domain.AdminLoginResp;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * @author destiny
 * @description:
 * @date 2025/10/25 23:57
 */
@SpringBootTest
class OpenAdminClientTest {

    @Autowired
    private AdminClient openAdminClient;

    @Test
    void authenticate() {
        R<AdminLoginResp> login = openAdminClient.login(AdminLoginRequest.builder()
            .username("admin")
            .password("admin123")
            .clientId("e5cd7e4891bf95d1d19206ce24a7b32e")
            .grantType("password")
            .uuid(UUID.fastUUID().toString())
            .tenantId("000000")
            .build());
        System.out.println("JSONUtil.toJsonStr(login) = " + JSONUtil.toJsonStr(login));
    }
}
