/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * 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 com.android.server.appsearch.appsindexer;

import java.util.concurrent.TimeUnit;

/**
 * An interface which exposes config flags to App Open Event Indexer.
 *
 * <p>Implementations of this interface must be thread-safe.
 *
 * @hide
 */
public interface AppOpenEventIndexerConfig {
    boolean DEFAULT_APP_OPEN_EVENT_INDEXER_ENABLED = true;

    /**
     * The default minimum internal in millis for two consecutive scheduled updates. This is set to
     * 1 day rather than 30 days (like other indexers) since it does not trigger on events like
     * package update, phone unlock, etc.
     */
    long DEFAULT_APP_OPEN_EVENT_INDEXER_UPDATE_INTERVAL_MILLIS = TimeUnit.DAYS.toMillis(1);

    /**
     * Returns the minimum time required to wait before attempting a sync after a previous sync,
     * regardless of whether the sync completes or not.
     */
    long DEFAULT_APP_OPEN_EVENT_MIN_TIME_BETWEEN_SYNCS_MILLIS = TimeUnit.HOURS.toMillis(1);

    /** Returns whether App Open Event Indexer is enabled. */
    boolean isAppOpenEventIndexerEnabled();

    /* Returns the minimum internal in millis for two consecutive scheduled updates. */
    long getAppOpenEventMaintenanceUpdateIntervalMillis();

    /**
     * Returns the minimum time required to wait before attempting a sync after a previous sync, in
     * milliseconds.
     */
    long getMinTimeBetweenSyncsMillis();
}
