/*
 *
 *    Copyright (c) 2023 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 "NamedPipeCommands.h"
#include "rvc-device.h"
#include <json/json.h>
#include <platform/DiagnosticDataProvider.h>

class RvcAppCommandHandler
{
public:
    static RvcAppCommandHandler * FromJSON(const char * json);

    static void HandleCommand(intptr_t context);

    RvcAppCommandHandler(Json::Value && jasonValue) : mJsonValue(std::move(jasonValue)) {}

    void SetRvcDevice(chip::app::Clusters::RvcDevice * aRvcDevice);

private:
    Json::Value mJsonValue;
    chip::app::Clusters::RvcDevice * mRvcDevice;

    /**
     * Should be called to notify that the device has finished charging.
     */
    void OnChargedHandler();

    void OnChargingHandler();

    void OnDockedHandler();

    void OnChargerFoundHandler();

    void OnLowChargeHandler();

    void OnActivityCompleteHandler();

    void OnErrorEventHandler(const std::string & error);

    void OnClearErrorHandler();
};

class RvcAppCommandDelegate : public NamedPipeCommandDelegate
{
private:
    chip::app::Clusters::RvcDevice * mRvcDevice;

public:
    void SetRvcDevice(chip::app::Clusters::RvcDevice * aRvcDevice);
    void OnEventCommandReceived(const char * json) override;
};
