/*
 *
 *    Copyright (c) 2024 Project CHIP Authors
 *    All rights reserved.
 *
 *    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.
 */

#pragma once

#include <lib/core/ScopedNodeId.h>
#include <platform/CHIPDeviceLayer.h>

#include "fabric_bridge_service/fabric_bridge_service.rpc.pb.h"

/**
 * @brief Sets the RPC server port to which the RPC client will connect.
 *
 * @param port The port number.
 */
void SetRpcRemoteServerPort(uint16_t port);

/**
 * @brief Starts packet processing for the RPC client.
 *
 * @return CHIP_NO_ERROR on successful start, or an appropriate CHIP_ERROR on failure.
 */
CHIP_ERROR StartRpcClient();

/**
 * @brief Adds a synchronized device to the RPC client.
 *
 * This function attempts to add a device identified by its `nodeId` to the synchronized device list.
 * It logs the progress and checks if an `AddSynchronizedDevice` operation is already in progress.
 * If an operation is in progress, it returns `CHIP_ERROR_BUSY`.
 *
 * @return CHIP_ERROR An error code indicating the success or failure of the operation.
 * - CHIP_NO_ERROR: The RPC command was successfully processed.
 * - CHIP_ERROR_BUSY: Another operation is currently in progress.
 * - CHIP_ERROR_INTERNAL: An internal error occurred while activating the RPC call.
 */
CHIP_ERROR AddSynchronizedDevice(const chip_rpc_SynchronizedDevice & data);

/**
 * @brief Removes a synchronized device from the RPC client.
 *
 * This function attempts to remove a device identified by its `nodeId` from the synchronized device list.
 * It logs the progress and checks if a `RemoveSynchronizedDevice` operation is already in progress.
 * If an operation is in progress, it returns `CHIP_ERROR_BUSY`.
 *
 * @param scopedNodeId The Scoped Node ID of the device to be removed.
 * @return CHIP_ERROR An error code indicating the success or failure of the operation.
 * - CHIP_NO_ERROR: The RPC command was successfully processed.
 * - CHIP_ERROR_BUSY: Another operation is currently in progress.
 * - CHIP_ERROR_INTERNAL: An internal error occurred while activating the RPC call.
 */
CHIP_ERROR RemoveSynchronizedDevice(chip::ScopedNodeId scopedNodeId);

/**
 * @brief Received StayActiveResponse on behalf of client that previously called KeepActive
 *
 * @param scopedNodeId The Scoped Node ID of the device we recieved a StayActiveResponse.
 * @param promisedActiveDurationMs the computed duration (in milliseconds) that the ICD intends to stay active for.
 * @return CHIP_ERROR An error code indicating the success or failure of the operation.
 * - CHIP_NO_ERROR: The RPC command was successfully processed.
 * - CHIP_ERROR_BUSY: Another operation is currently in progress.
 * - CHIP_ERROR_INTERNAL: An internal error occurred while activating the RPC call.
 */
CHIP_ERROR ActiveChanged(chip::ScopedNodeId scopedNodeId, uint32_t promisedActiveDurationMs);

/**
 * @brief CADMIN attribute has changed of one of the bridged devices that was previously added.
 *
 * @param data information regarding change in AdministratorCommissioning attributes
 * @return CHIP_ERROR An error code indicating the success or failure of the operation.
 * - CHIP_NO_ERROR: The RPC command was successfully processed.
 * - CHIP_ERROR_BUSY: Another operation is currently in progress.
 * - CHIP_ERROR_INTERNAL: An internal error occurred while activating the RPC call.
 */
CHIP_ERROR AdminCommissioningAttributeChanged(const chip_rpc_AdministratorCommissioningChanged & data);

/**
 * @brief Notify that reachachability of the bridged device has changed
 *
 * @param data information regarding change in reachability of the bridged device.
 * @return CHIP_ERROR An error code indicating the success or failure of the operation.
 * - CHIP_NO_ERROR: The RPC command was successfully processed.
 * - CHIP_ERROR_BUSY: Another operation is currently in progress.
 * - CHIP_ERROR_INTERNAL: An internal error occurred while activating the RPC call.
 */
CHIP_ERROR DeviceReachableChanged(const chip_rpc_ReachabilityChanged & data);
