/*
 * Copyright (c) 2022 Huawei Device Co., Ltd.
 * 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.
 */

/**
 * @addtogroup HdfFingerprintAuth
 * @{
 *
 * @brief Provides APIs for the fingerprint auth driver.
 *
 * The fingerprint auth driver provides a unified interface for the fingerprint auth service to access the fingerprint auth driver.
 * After obtaining the fingerprint auth driver proxy, the service can call related APIs to obtain executors.
 * After obtaining the fingerprint auth executors, the service can call related APIs to get executor info, get
 * template info, enroll template, authenticate template, delete template, etc.
 *
 * @since 3.2
 */

/**
 * @file IExecutor.idl
 *
 * @brief Defines the APIs of executor. These APIs can be used to get executor info, get
 * template info, enroll template, authenticate template, delete template, etc.
 *
 * @since 3.2
 */

package ohos.hdi.fingerprint_auth.v1_0;

import ohos.hdi.fingerprint_auth.v1_0.FingerprintAuthTypes;
import ohos.hdi.fingerprint_auth.v1_0.IExecutorCallback;

/**
 * @brief Defines the APIs of executor. These APIs can be used to get executor info, get
 * template info, enroll template, authenticate template, delete template, etc.
 *
 * @since 3.2
 * @version 1.0
 */
interface IExecutor {
    /**
     * @brief Get executor info.
     *
     * @param executorInfo Indicates executor info, see {@link ExecutorInfo}.
     *
     * @return Returns <b>0</b> if the operation is successful.
     * @return Returns a non-zero value if the operation fails.
     */
    GetExecutorInfo([out] struct ExecutorInfo executorInfo);
    /**
     * @brief Get template info.
     *
     * @param templateId Indicates template id.
     * @param templateInfo Indicates template info, see {@link TemplateInfo}.
     *
     * @return Returns <b>0</b> if the operation is successful.
     * @return Returns a non-zero value if the operation fails.
     *
     * @deprecated
     */
    GetTemplateInfo([in] unsigned long templateId, [out] struct TemplateInfo templateInfo);
    /**
     * @brief Send parameters to driver when executor register finish.
     *
     * @param templateIdList Indicates templates previously registered to userauth framework.
     * @param frameworkPublicKey Indicates framework public key.
     * @param extraInfo Indicates extra info send to executor.
     *
     * @return Returns <b>0</b> if the operation is successful.
     * @return Returns a non-zero value if the operation fails.
     */
    OnRegisterFinish([in] unsigned long[] templateIdList, [in] unsigned char[] frameworkPublicKey, [in] unsigned char[] extraInfo);
    /**
     * @brief Enroll template.
     *
     * @param scheduleId Indicates schedule id of enroll.
     * @param extraInfo Indicates extra info of enroll.
     * @param callbackObj Indicates enroll callback object, see {@link IExecutorCallback}.
     *
     * @return Returns <b>0</b> if the operation is successful.
     * @return Returns a non-zero value if the operation fails.
     */
    Enroll([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj);
    /**
     * @brief Authenticate template.
     *
     * @param scheduleId Indicates schedule id of authenticate.
     * @param templateIdList Indicates the templates to authenticate.
     * @param extraInfo Indicates extra info of authenticate.
     * @param callbackObj Indicates authenticate callback object, see {@link IExecutorCallback}.
     *
     * @return Returns <b>0</b> if the operation is successful.
     * @return Returns a non-zero value if the operation fails.
     *
     * @deprecated
     */
    Authenticate([in] unsigned long scheduleId, [in] unsigned long[] templateIdList, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj);
    /**
     * @brief Identify template.
     *
     * @param scheduleId Indicates schedule id of identify.
     * @param extraInfo Indicates extra info of identify.
     * @param callbackObj Indicates identify callback object, see {@link IExecutorCallback}.
     *
     * @return Returns <b>0</b> if the operation is successful.
     * @return Returns a non-zero value if the operation fails.
     */
    Identify([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj);
    /**
     * @brief Delete templates.
     *
     * @param templateIdList Indicates the templates to delete.
     *
     * @return Returns <b>0</b> if the operation is successful.
     * @return Returns a non-zero value if the operation fails.
     */
    Delete([in] unsigned long[] templateIdList);
    /**
     * @brief Cancel enroll, authenticate or identify operation.
     *
     * @param scheduleId Indicates schedule id of operation to cancel.
     *
     * @return Returns <b>0</b> if the operation is successful.
     * @return Returns a non-zero value if the operation fails.
     */
    Cancel([in] unsigned long scheduleId);
    /**
     * @brief Send command to driver.
     *
     * @param commandId Indicates command id. For details, see {@link CommandId}.
     * @param extraInfo Indicates extra info of command.
     * @param callbackObj Indicates command callback object, see {@link IExecutorCallback}.
     *
     * @return Returns <b>0</b> if the operation is successful.
     * @return Returns a non-zero value if the operation fails.
     */
    SendCommand([in] int commandId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj);
}