/*
 *
 *    Copyright (c) 2022 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.
 */

// THIS FILE IS GENERATED BY ZAP
// This file is generated from clusters-Events.h.zapt

#pragma once

#include <app/EventLoggingTypes.h>
#include <app/data-model/DecodableList.h>
#include <app/data-model/List.h>
#include <app/data-model/Nullable.h>
#include <lib/core/DataModelTypes.h>
#include <lib/core/TLV.h>
#include <lib/support/BitMask.h>

#include <clusters/shared/Enums.h>
#include <clusters/shared/Structs.h>

#include <clusters/OtaSoftwareUpdateRequestor/ClusterId.h>
#include <clusters/OtaSoftwareUpdateRequestor/Enums.h>
#include <clusters/OtaSoftwareUpdateRequestor/EventIds.h>
#include <clusters/OtaSoftwareUpdateRequestor/Structs.h>

#include <cstdint>

namespace chip {
namespace app {
namespace Clusters {
namespace OtaSoftwareUpdateRequestor {
namespace Events {
namespace StateTransition {
static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info;

enum class Fields : uint8_t {
  kPreviousState = 0,
  kNewState = 1,
  kReason = 2,
  kTargetSoftwareVersion = 3,
};

struct Type {
public:
  static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; }
  static constexpr EventId GetEventId() { return Events::StateTransition::Id; }
  static constexpr ClusterId GetClusterId() {
    return Clusters::OtaSoftwareUpdateRequestor::Id;
  }
  static constexpr bool kIsFabricScoped = false;

  UpdateStateEnum previousState = static_cast<UpdateStateEnum>(0);
  UpdateStateEnum newState = static_cast<UpdateStateEnum>(0);
  ChangeReasonEnum reason = static_cast<ChangeReasonEnum>(0);
  DataModel::Nullable<uint32_t> targetSoftwareVersion;

  CHIP_ERROR Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const;
};

struct DecodableType {
public:
  static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; }
  static constexpr EventId GetEventId() { return Events::StateTransition::Id; }
  static constexpr ClusterId GetClusterId() {
    return Clusters::OtaSoftwareUpdateRequestor::Id;
  }

  UpdateStateEnum previousState = static_cast<UpdateStateEnum>(0);
  UpdateStateEnum newState = static_cast<UpdateStateEnum>(0);
  ChangeReasonEnum reason = static_cast<ChangeReasonEnum>(0);
  DataModel::Nullable<uint32_t> targetSoftwareVersion;

  CHIP_ERROR Decode(TLV::TLVReader &reader);
};
} // namespace StateTransition
namespace VersionApplied {
static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Critical;

enum class Fields : uint8_t {
  kSoftwareVersion = 0,
  kProductID = 1,
};

struct Type {
public:
  static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; }
  static constexpr EventId GetEventId() { return Events::VersionApplied::Id; }
  static constexpr ClusterId GetClusterId() {
    return Clusters::OtaSoftwareUpdateRequestor::Id;
  }
  static constexpr bool kIsFabricScoped = false;

  uint32_t softwareVersion = static_cast<uint32_t>(0);
  uint16_t productID = static_cast<uint16_t>(0);

  CHIP_ERROR Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const;
};

struct DecodableType {
public:
  static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; }
  static constexpr EventId GetEventId() { return Events::VersionApplied::Id; }
  static constexpr ClusterId GetClusterId() {
    return Clusters::OtaSoftwareUpdateRequestor::Id;
  }

  uint32_t softwareVersion = static_cast<uint32_t>(0);
  uint16_t productID = static_cast<uint16_t>(0);

  CHIP_ERROR Decode(TLV::TLVReader &reader);
};
} // namespace VersionApplied
namespace DownloadError {
static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info;

enum class Fields : uint8_t {
  kSoftwareVersion = 0,
  kBytesDownloaded = 1,
  kProgressPercent = 2,
  kPlatformCode = 3,
};

struct Type {
public:
  static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; }
  static constexpr EventId GetEventId() { return Events::DownloadError::Id; }
  static constexpr ClusterId GetClusterId() {
    return Clusters::OtaSoftwareUpdateRequestor::Id;
  }
  static constexpr bool kIsFabricScoped = false;

  uint32_t softwareVersion = static_cast<uint32_t>(0);
  uint64_t bytesDownloaded = static_cast<uint64_t>(0);
  DataModel::Nullable<uint8_t> progressPercent;
  DataModel::Nullable<int64_t> platformCode;

  CHIP_ERROR Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const;
};

struct DecodableType {
public:
  static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; }
  static constexpr EventId GetEventId() { return Events::DownloadError::Id; }
  static constexpr ClusterId GetClusterId() {
    return Clusters::OtaSoftwareUpdateRequestor::Id;
  }

  uint32_t softwareVersion = static_cast<uint32_t>(0);
  uint64_t bytesDownloaded = static_cast<uint64_t>(0);
  DataModel::Nullable<uint8_t> progressPercent;
  DataModel::Nullable<int64_t> platformCode;

  CHIP_ERROR Decode(TLV::TLVReader &reader);
};
} // namespace DownloadError
} // namespace Events
} // namespace OtaSoftwareUpdateRequestor
} // namespace Clusters
} // namespace app
} // namespace chip
