package com.izouma.nineth.config;

import com.gexin.rp.sdk.http.IGtPush;
import lombok.AllArgsConstructor;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@AllArgsConstructor
@Configuration
@EnableConfigurationProperties(PushProperties.class)
public class PushConfig {

    /**
     * 返回推送详情
     */
    public static final String GEXIN_PUSHSINGLE_ALIASDETAIL = "gexin_pushSingle_aliasDetail";

    private PushProperties pushProperties;

    @Bean
    public IGtPush iGtPush(){
        System.setProperty(GEXIN_PUSHSINGLE_ALIASDETAIL, "true");

        IGtPush iGtPush = new IGtPush(pushProperties.getUrl(), pushProperties.getAppKey(), pushProperties.getMasterSecret());
        return iGtPush;
    }

}
