package org.tio.sitexxx.service.service.jpush.honor.util;

import org.tio.sitexxx.service.service.jpush.honor.messaging.HonorApp;
import org.tio.sitexxx.service.service.jpush.honor.messaging.HonorCredential;
import org.tio.sitexxx.service.service.jpush.honor.messaging.HonorOption;

/**
 * <pre>
 *    @author : vagrancy
 *    e-mail : 18050829067@163.com
 *    time   : 2025-02-26 14:47
 *    desc   :
 * </pre>
 */
public class InitHonorUtils {
    /**
     * @return HuaweiApp
     */
    public static HonorApp initializeApp() {
        String appId = "104483863";
        String clientId = "42368a1450b2475d8c477483edb11143";
        String clientSecret = "S0Sy85VtzsWNmhrBzoSQFIra2c54ZvcY";
        // Create HuaweiCredential
        // This appId and appSecret come from Huawei Developer Alliance
        return initializeApp(appId, clientId, clientSecret);
    }

    private static HonorApp initializeApp(String appId, String clientId, String clientSecret) {
        HonorCredential credential = HonorCredential.builder()
                .setAppId(appId)
                .setClientId(clientId)
                .setClientSecret(clientSecret)
                .build();

        // Create HuaweiOption
        HonorOption option = HonorOption.builder()
                .setCredential(credential)
                .build();

        // Initialize HuaweiApp
//        return HuaweiApp.initializeApp(option);
        return HonorApp.getInstance(option);
    }
}
