//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
//
package com.microsoft.cognitiveservices.speech.util;

import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;

/*! \cond INTERNAL */

/**
 * Internal ContentProvider class. The sole purpose of this class is to provide a context to the SDK.
 * When the app launches, onCreate method will receive a lifecycle callback. At that time, we obtain the
 * Context object and store it in the ContextHolder object. This is needed for the SDK to be able to
 * access assets, get files or cache directory location, etc.
 * This class is inaccessable outside of the SDK (by setting the attribute android:exported="false" in
 * AndroidManifest.xml for this provider).
 */
public class InternalContentProvider extends ContentProvider {
    @Override
    public boolean onCreate() {
        ContextHolder contextHolder = ContextHolder.getInstance();
        contextHolder.setContext(getContext());
        return true;
    }

    /**
     * Overrides query method of ContentProvider class with no implementation.
     * @param uri Unused parameter
     * @param projection Unused parameter
     * @param selection Unused parameter
     * @param selectionArgs Unused parameter
     * @param sortOrder Unused parameter
     * @return null
     */
    @Override
    public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
        return null;
    }

    /**
     * Overrides getType method of ContentProvider class with no implementation.
     * @param uri Unused parameter
     * @return null
     */
    @Override
    public String getType(Uri uri) {
        return null;
    }

    
    /**
     * Overrides insert method of ContentProvider class with no implementation.
     * @param uri Unused parameter
     * @param values Unused parameter
     * @return null
     */
    @Override
    public Uri insert(Uri uri, ContentValues values) {
        return null;
    }

    /**
     * Overrides delete method of ContentProvider class with no implementation.
     * @param uri Unused parameter
     * @param selection Unused parameter
     * @param selectionArgs Unused parameter
     * @return 0
     */
    @Override
    public int delete(Uri uri, String selection, String[] selectionArgs) {
        return 0;
    }

    /**
     * Overrides update method of ContentProvider class with no implementation.
     * @param uri Unused parameter
     * @param values Unused parameter
     * @param selection Unused parameter
     * @param selectionArgs Unused parameter
     * @return 0
     */
    @Override
    public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
        return 0;
    }
}

/*! \endcond */