{% if action.is_request or action.is_send %}
// SPDX-License-Identifier: Apache-2.0
// Copyright 2020 - {{year}} Pionix GmbH and Contributors to EVerest
// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually

#ifndef OCPP_{{namespace | upper}}_{{ action.name|upper }}_HPP
#define OCPP_{{namespace | upper}}_{{ action.name|upper }}_HPP

{% if uses_optional %}
#include <optional>
{% endif %}
#include <nlohmann/json_fwd.hpp>

{% if needs_constants %}
#include <ocpp/{{namespace}}/constants.hpp>
{% endif %}
{% if needs_enums %}
{% if namespace == 'v21' %}
#include <ocpp/v2/ocpp_enums.hpp>
{% else %}
#include <ocpp/{{namespace}}/ocpp_enums.hpp>
{% endif %}
{% endif %}
{% if namespace == 'v21' %}
#include <ocpp/v2/ocpp_types.hpp>
using namespace ocpp::v2;
{% else %}
#include <ocpp/{{namespace}}/ocpp_types.hpp>
{% endif %}
{% if needs_types %}
#include <ocpp/common/types.hpp>
{% endif %}

namespace ocpp {
namespace {{namespace}} {
{% endif %}
{% for type in types %}
{% if type.name == action.class_name %}

/// \brief Contains a OCPP {{ type.name | replace('Request', '') }} message
struct {{ type.name }} : public ocpp::Message {
{% for property in type.properties %}
    {{ 'std::optional<' if not property.required -}}
    {{ property.type -}}
    {{ '>' if not property.required -}}
    {{ ' ' + property.name + ';' }}
{% endfor %}

{% if loop.last %}

    /// \brief Provides the type of this {{ type.name | replace('Request', '') }} message as a human readable string
    /// \returns the message type as a human readable string
    std::string get_type() const override;
};

/// \brief Conversion from a given {{ type.name }} \p k to a given json object \p j
void to_json(json& j, const {{ type.name }}& k);

/// \brief Conversion from a given json object \p j to a given {{ type.name }} \p k
void from_json(const json& j, {{ type.name }}& k);

/// \brief Writes the string representation of the given {{ type.name }} \p k to the given output stream \p os
/// \returns an output stream with the {{ type.name }} written to
std::ostream& operator<<(std::ostream& os, const {{ type.name }}& k);

{% endif %}

{% endif %}
{% endfor %}

{% if not action.is_request or action.is_send %}
} // namespace {{namespace}}
} // namespace ocpp

#endif // OCPP_{{namespace | upper}}_{{ action.name|upper }}_HPP
{% endif %}
