package com.sikey.wa04.business.infrastructure.adapter.push;

import com.eatthepath.pushy.apns.ApnsClient;
import com.sikey.wa04.business.infrastructure.adapter.push.template.NotificationMessageTemplate;
import com.sikey.wa04.business.infrastructure.configuration.PushConfig;

import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.concurrent.ExecutionException;

public interface IOSPushNotification extends PushNotification {

    /**
     * Authenticate the push notification
     *
     * @param pushConfig the push config
     * @return the apns client
     * @throws IOException              ioe
     * @throws NoSuchAlgorithmException nae
     * @throws InvalidKeyException      ie
     */
    ApnsClient authenticate(PushConfig pushConfig) throws IOException, NoSuchAlgorithmException, InvalidKeyException;

    /**
     * 推送
     *
     * @param message    消息
     * @param apnsClient 客户端
     */
    SendResult send(NotificationMessageTemplate message, ApnsClient apnsClient) throws IOException, ExecutionException, InterruptedException;
}
