// Path: opfpush/src/main/java/org/onepf/opfpush/listener/CheckManifestHandler.java
// public interface CheckManifestHandler {
// 
//     /**
//      * Called when some check manifest error occurred.
//      *
//      * @param reportMessage The information about error.
//      */
//     void onCheckManifestError(@NonNull final String reportMessage);
// }
// 
// Path: opfpush/src/main/java/org/onepf/opfpush/model/AvailabilityResult.java
// public final class AvailabilityResult {
// 
//     private boolean isAvailable;
// 
//     @Nullable
//     private Integer errorCode;
// 
//     public AvailabilityResult(final boolean isAvailable) {
//         this(isAvailable, null);
//     }
// 
//     public AvailabilityResult(@NonNull final Integer errorCode) {
//         this(false, errorCode);
//     }
// 
//     public AvailabilityResult(final boolean isAvailable, @Nullable final Integer errorCode) {
//         this.isAvailable = isAvailable;
//         this.errorCode = errorCode;
//     }
// 
//     /**
//      * Returns {@code true} if a provider is available, false otherwise.
//      *
//      * @return {@code true} if a provider is available, false otherwise.
//      */
//     public boolean isAvailable() {
//         return isAvailable;
//     }
// 
//     /**
//      * Returns a specific provider error code.
//      *
//      * @return The availability error code, or {@code null} if a provider hasn't returned a error code.
//      */
//     @Nullable
//     public Integer getErrorCode() {
//         return errorCode;
//     }
// }
// 
// Path: opfpush/src/main/java/org/onepf/opfpush/notification/NotificationMaker.java
// public interface NotificationMaker {
// 
//     /**
//      * Returns true if a notification must be shown for the bundle. False otherwise.
//      *
//      * @param bundle The bundle received from a push provider.
//      * @return Returns true if a notification should be shown for the bundle. False otherwise.
//      */
//     boolean needShowNotification(@NonNull final Bundle bundle);
// 
//     /**
//      * Shows notification using bundle data.
//      *
//      * @param context The Context instance.
//      * @param bundle  Received data.
//      */
//     void showNotification(@NonNull final Context context, @NonNull final Bundle bundle);
// }


import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import org.onepf.opfpush.listener.CheckManifestHandler;
import org.onepf.opfpush.model.AvailabilityResult;
import org.onepf.opfpush.notification.NotificationMaker;
/*
 * Copyright 2012-2015 One Platform Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.onepf.opfpush.pushprovider;



/**
 * The {@code PushProvider} interface represent the provider for push notification from the server to
 * the client app.
 * <p/>
 * The {@link #register()} and {@link #unregister()} methods intended for the internal use,
 * should never be called directly.
 * Use {@link org.onepf.opfpush.OPFPushHelper#register()} or {@link org.onepf.opfpush.OPFPushHelper#unregister()} to start registration
 * or unregistration.
 *
 * @author Anton Rutkevich, Alexey Vitenko, Kirill Rozov
 * @since 14.05.14
 */
public interface PushProvider {
    /**
     * Initiates the registration of the provider. Must be async.
     * <p/>
     * Intended for the internal use, should never be called directly.
     * To start the registration call {@link org.onepf.opfpush.OPFPushHelper#register()}.
     */
    void register();

    /**
     * Initiates the unregistering of the provider. Must be async.
     * <p/>
     * Intended for internal use, should never be called directly.
     * To start registration call {@link org.onepf.opfpush.OPFPushHelper#unregister()}.
     */
    void unregister();

    /**
     * Checks whether the provider is available.
     *
     * @return The instance of {@link org.onepf.opfpush.model.AvailabilityResult}
     * that contains result of availability check.
     */
    @NonNull
    AvailabilityResult getAvailabilityResult();

    /**
     * Checks whether the application was successfully registered on the service.
     *
     * @return {@code true} if the application was successfully registered on the service, otherwise false.
     */
    boolean isRegistered();

    /**
     * Returns the registration ID or null if provider isn't registered.
     *
     * @return The registration ID or null if provider isn't registered.
     */
    @Nullable
    String getRegistrationId();

    /**
     * Returns the name of the provider. Must be unique for all providers.
     *
     * @return The name of the provider.
     */
    @NonNull
    String getName();

    /**
     * Returns the package of the application that contains API of the provider.
     * Usually, this is a store application.
     *
     * @return The package of the application that contains API of the provider.
     */
    @Nullable
    String getHostAppPackage();

    /**
     * Returns the {@link NotificationMaker} object associated with provider.
     *
     * @return The {@link NotificationMaker} instance.
     */
    @NonNull
    NotificationMaker getNotificationMaker();

    /**
     * Verify that application manifest contains all needed permissions.
     *
     * @param checkManifestHandler If not null an exception isn't thrown.
     * @throws java.lang.IllegalStateException If not all required permissions and components have been
     *                                         described in the AndroidManifest.xml file.
     */
// Path: opfpush/src/main/java/org/onepf/opfpush/listener/CheckManifestHandler.java
// public interface CheckManifestHandler {
// 
//     /**
//      * Called when some check manifest error occurred.
//      *
//      * @param reportMessage The information about error.
//      */
//     void onCheckManifestError(@NonNull final String reportMessage);
// }
// 
// Path: opfpush/src/main/java/org/onepf/opfpush/model/AvailabilityResult.java
// public final class AvailabilityResult {
// 
//     private boolean isAvailable;
// 
//     @Nullable
//     private Integer errorCode;
// 
//     public AvailabilityResult(final boolean isAvailable) {
//         this(isAvailable, null);
//     }
// 
//     public AvailabilityResult(@NonNull final Integer errorCode) {
//         this(false, errorCode);
//     }
// 
//     public AvailabilityResult(final boolean isAvailable, @Nullable final Integer errorCode) {
//         this.isAvailable = isAvailable;
//         this.errorCode = errorCode;
//     }
// 
//     /**
//      * Returns {@code true} if a provider is available, false otherwise.
//      *
//      * @return {@code true} if a provider is available, false otherwise.
//      */
//     public boolean isAvailable() {
//         return isAvailable;
//     }
// 
//     /**
//      * Returns a specific provider error code.
//      *
//      * @return The availability error code, or {@code null} if a provider hasn't returned a error code.
//      */
//     @Nullable
//     public Integer getErrorCode() {
//         return errorCode;
//     }
// }
// 
// Path: opfpush/src/main/java/org/onepf/opfpush/notification/NotificationMaker.java
// public interface NotificationMaker {
// 
//     /**
//      * Returns true if a notification must be shown for the bundle. False otherwise.
//      *
//      * @param bundle The bundle received from a push provider.
//      * @return Returns true if a notification should be shown for the bundle. False otherwise.
//      */
//     boolean needShowNotification(@NonNull final Bundle bundle);
// 
//     /**
//      * Shows notification using bundle data.
//      *
//      * @param context The Context instance.
//      * @param bundle  Received data.
//      */
//     void showNotification(@NonNull final Context context, @NonNull final Bundle bundle);
// }


// Path: opfpush/src/main/java/org/onepf/opfpush/pushprovider/PushProvider.java
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import org.onepf.opfpush.listener.CheckManifestHandler;
import org.onepf.opfpush.model.AvailabilityResult;
import org.onepf.opfpush.notification.NotificationMaker;

/*
 * Copyright 2012-2015 One Platform Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.onepf.opfpush.pushprovider;



/**
 * The {@code PushProvider} interface represent the provider for push notification from the server to
 * the client app.
 * <p/>
 * The {@link #register()} and {@link #unregister()} methods intended for the internal use,
 * should never be called directly.
 * Use {@link org.onepf.opfpush.OPFPushHelper#register()} or {@link org.onepf.opfpush.OPFPushHelper#unregister()} to start registration
 * or unregistration.
 *
 * @author Anton Rutkevich, Alexey Vitenko, Kirill Rozov
 * @since 14.05.14
 */
public interface PushProvider {
    /**
     * Initiates the registration of the provider. Must be async.
     * <p/>
     * Intended for the internal use, should never be called directly.
     * To start the registration call {@link org.onepf.opfpush.OPFPushHelper#register()}.
     */
    void register();

    /**
     * Initiates the unregistering of the provider. Must be async.
     * <p/>
     * Intended for internal use, should never be called directly.
     * To start registration call {@link org.onepf.opfpush.OPFPushHelper#unregister()}.
     */
    void unregister();

    /**
     * Checks whether the provider is available.
     *
     * @return The instance of {@link org.onepf.opfpush.model.AvailabilityResult}
     * that contains result of availability check.
     */
    @NonNull
    AvailabilityResult getAvailabilityResult();

    /**
     * Checks whether the application was successfully registered on the service.
     *
     * @return {@code true} if the application was successfully registered on the service, otherwise false.
     */
    boolean isRegistered();

    /**
     * Returns the registration ID or null if provider isn't registered.
     *
     * @return The registration ID or null if provider isn't registered.
     */
    @Nullable
    String getRegistrationId();

    /**
     * Returns the name of the provider. Must be unique for all providers.
     *
     * @return The name of the provider.
     */
    @NonNull
    String getName();

    /**
     * Returns the package of the application that contains API of the provider.
     * Usually, this is a store application.
     *
     * @return The package of the application that contains API of the provider.
     */
    @Nullable
    String getHostAppPackage();

    /**
     * Returns the {@link NotificationMaker} object associated with provider.
     *
     * @return The {@link NotificationMaker} instance.
     */
    @NonNull
    NotificationMaker getNotificationMaker();

    /**
     * Verify that application manifest contains all needed permissions.
     *
     * @param checkManifestHandler If not null an exception isn't thrown.
     * @throws java.lang.IllegalStateException If not all required permissions and components have been
     *                                         described in the AndroidManifest.xml file.
     */
    void checkManifest(@Nullable CheckManifestHandler checkManifestHandler);