/**
 *
 *    Copyright (c) 2020 Project CHIP Authors
 *
 *    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 <app/util/basic-types.h>
#include <support/BufferWriter.h>

typedef uint16_t EmberApsOption;

/** @brief An in-memory representation of a ZigBee APS frame
 * of an incoming or outgoing message. Copy pasted here so that we can compile this unit of code independently.
 */
typedef struct
{
    /** The cluster ID for this message. */
    chip::ClusterId clusterId;
    /** The source endpoint. */
    chip::EndpointId sourceEndpoint;
    /** The destination endpoint. */
    chip::EndpointId destinationEndpoint;
    /** A bitmask of options from the enumeration above. */
    EmberApsOption options;
    /** The group ID for this message, if it is multicast mode. */
    chip::GroupId groupId;
    /** The sequence number. */
    uint8_t sequence;
    uint8_t radius;
} EmberApsFrame;

/** @brief Extracts an aps frame from buffer into outApsFrame
 * @param buffer Buffer to read from
 * @param buf_length Length of buffer
 * @param outApsFrame Pointer to EmberApsFrame struct to read into
 * @return returns the number of bytes that were consumed to read out the EmberApsFrame. 0 means an error was encountered
 */
uint16_t extractApsFrame(uint8_t * buffer, uint16_t buf_length, EmberApsFrame * outApsFrame);

/** @brief Populates msg with address of the zcl message within buffer.
 * @return Returns the length of msg buffer. Returns 0 on error e.g. if buffer is too short.
 */
uint16_t extractMessage(uint8_t * buffer, uint16_t buffer_length, uint8_t ** msg);

/** @brief Prints an aps frame struct
 */
void printApsFrame(EmberApsFrame * frame);

/**
 * @brief Encode an APS frame into the given buffer.  Returns the number of
 * bytes of buffer used by the encoding or 0 if the given buffer is not big
 * enough.  If buffer is null, no encoding will happen; the function will
 * instead return the number of bytes that would be needed to encode the APS
 * frame.
 *
 * @param[in] buffer The buffer to write to.  If null, the call is in "count the
 *                   bytes" mode, and no writing will happen.
 * @parem[in] buf_length The size of the buffer.  Ignored if buffer is null.
 * @param[in] apsFrame The frame to encode.
 *
 * @return
 *   - If buffer is null, the number of bytes needed to encode.  If this number
 *     does not fit in a uint16_t, 0 will be returned.
 *   - If buffer is non-null but buf_length is not enough to hold the
 *     EmberApsFrame, 0.
 *   - If buffer is non-null and buf_length is large enough, the number of bytes
 *     placed in buffer.
 */
uint16_t encodeApsFrame(uint8_t * buffer, uint16_t buf_length, EmberApsFrame * apsFrame);

/**
 * @brief Encode the given informations into the given BufferWriter.
 * Returns the number of bytes of buffer used by the encoding or 0 if
 * the given buffer is not big enough.
 *
 * @return
 *   - If the buffer length is not enough to hold the EmberApsFrame, 0.
 *   - If the buffer length is large enough, the number of bytes placed in buffer.
 */
uint16_t doEncodeApsFrame(chip::Encoding::LittleEndian::BufferWriter & buf, chip::ClusterId clusterId,
                          chip::EndpointId sourceEndpoint, chip::EndpointId destinationEndpoint, EmberApsOption options,
                          chip::GroupId groupId, uint8_t sequence, uint8_t radius, bool isMeasuring);
