/*
 *
 *    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-Commands.h.zapt

#pragma once

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

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

#include <clusters/OtaSoftwareUpdateProvider/ClusterId.h>
#include <clusters/OtaSoftwareUpdateProvider/CommandIds.h>
#include <clusters/OtaSoftwareUpdateProvider/Enums.h>
#include <clusters/OtaSoftwareUpdateProvider/Structs.h>

#include <cstdint>

namespace chip {
namespace app {
namespace Clusters {
namespace OtaSoftwareUpdateProvider {
namespace Commands {
// Forward-declarations so we can reference these later.

namespace QueryImage {
struct Type;
struct DecodableType;
} // namespace QueryImage

namespace QueryImageResponse {
struct Type;
struct DecodableType;
} // namespace QueryImageResponse

namespace ApplyUpdateRequest {
struct Type;
struct DecodableType;
} // namespace ApplyUpdateRequest

namespace ApplyUpdateResponse {
struct Type;
struct DecodableType;
} // namespace ApplyUpdateResponse

namespace NotifyUpdateApplied {
struct Type;
struct DecodableType;
} // namespace NotifyUpdateApplied

} // namespace Commands

namespace Commands {
namespace QueryImage {
enum class Fields : uint8_t {
  kVendorID = 0,
  kProductID = 1,
  kSoftwareVersion = 2,
  kProtocolsSupported = 3,
  kHardwareVersion = 4,
  kLocation = 5,
  kRequestorCanConsent = 6,
  kMetadataForProvider = 7,
};

struct Type {
public:
  // Use GetCommandId instead of commandId directly to avoid naming conflict
  // with CommandIdentification in ExecutionOfACommand
  static constexpr CommandId GetCommandId() { return Commands::QueryImage::Id; }
  static constexpr ClusterId GetClusterId() {
    return Clusters::OtaSoftwareUpdateProvider::Id;
  }

  chip::VendorId vendorID = static_cast<chip::VendorId>(0);
  uint16_t productID = static_cast<uint16_t>(0);
  uint32_t softwareVersion = static_cast<uint32_t>(0);
  DataModel::List<const DownloadProtocolEnum> protocolsSupported;
  Optional<uint16_t> hardwareVersion;
  Optional<chip::CharSpan> location;
  Optional<bool> requestorCanConsent;
  Optional<chip::ByteSpan> metadataForProvider;

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

  using ResponseType = Clusters::OtaSoftwareUpdateProvider::Commands::
      QueryImageResponse::DecodableType;

  static constexpr bool MustUseTimedInvoke() { return false; }
};

struct DecodableType {
public:
  static constexpr CommandId GetCommandId() { return Commands::QueryImage::Id; }
  static constexpr ClusterId GetClusterId() {
    return Clusters::OtaSoftwareUpdateProvider::Id;
  }
  static constexpr bool kIsFabricScoped = false;

  chip::VendorId vendorID = static_cast<chip::VendorId>(0);
  uint16_t productID = static_cast<uint16_t>(0);
  uint32_t softwareVersion = static_cast<uint32_t>(0);
  DataModel::DecodableList<DownloadProtocolEnum> protocolsSupported;
  Optional<uint16_t> hardwareVersion;
  Optional<chip::CharSpan> location;
  Optional<bool> requestorCanConsent;
  Optional<chip::ByteSpan> metadataForProvider;

  CHIP_ERROR Decode(TLV::TLVReader &reader);
};
}; // namespace QueryImage
namespace QueryImageResponse {
enum class Fields : uint8_t {
  kStatus = 0,
  kDelayedActionTime = 1,
  kImageURI = 2,
  kSoftwareVersion = 3,
  kSoftwareVersionString = 4,
  kUpdateToken = 5,
  kUserConsentNeeded = 6,
  kMetadataForRequestor = 7,
};

struct Type {
public:
  // Use GetCommandId instead of commandId directly to avoid naming conflict
  // with CommandIdentification in ExecutionOfACommand
  static constexpr CommandId GetCommandId() {
    return Commands::QueryImageResponse::Id;
  }
  static constexpr ClusterId GetClusterId() {
    return Clusters::OtaSoftwareUpdateProvider::Id;
  }

  StatusEnum status = static_cast<StatusEnum>(0);
  Optional<uint32_t> delayedActionTime;
  Optional<chip::CharSpan> imageURI;
  Optional<uint32_t> softwareVersion;
  Optional<chip::CharSpan> softwareVersionString;
  Optional<chip::ByteSpan> updateToken;
  Optional<bool> userConsentNeeded;
  Optional<chip::ByteSpan> metadataForRequestor;

  CHIP_ERROR Encode(DataModel::FabricAwareTLVWriter &aWriter,
                    TLV::Tag aTag) const;

  using ResponseType = DataModel::NullObjectType;

  static constexpr bool MustUseTimedInvoke() { return false; }
};

struct DecodableType {
public:
  static constexpr CommandId GetCommandId() {
    return Commands::QueryImageResponse::Id;
  }
  static constexpr ClusterId GetClusterId() {
    return Clusters::OtaSoftwareUpdateProvider::Id;
  }

  StatusEnum status = static_cast<StatusEnum>(0);
  Optional<uint32_t> delayedActionTime;
  Optional<chip::CharSpan> imageURI;
  Optional<uint32_t> softwareVersion;
  Optional<chip::CharSpan> softwareVersionString;
  Optional<chip::ByteSpan> updateToken;
  Optional<bool> userConsentNeeded;
  Optional<chip::ByteSpan> metadataForRequestor;

  CHIP_ERROR Decode(TLV::TLVReader &reader);
};
}; // namespace QueryImageResponse
namespace ApplyUpdateRequest {
enum class Fields : uint8_t {
  kUpdateToken = 0,
  kNewVersion = 1,
};

struct Type {
public:
  // Use GetCommandId instead of commandId directly to avoid naming conflict
  // with CommandIdentification in ExecutionOfACommand
  static constexpr CommandId GetCommandId() {
    return Commands::ApplyUpdateRequest::Id;
  }
  static constexpr ClusterId GetClusterId() {
    return Clusters::OtaSoftwareUpdateProvider::Id;
  }

  chip::ByteSpan updateToken;
  uint32_t newVersion = static_cast<uint32_t>(0);

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

  using ResponseType = Clusters::OtaSoftwareUpdateProvider::Commands::
      ApplyUpdateResponse::DecodableType;

  static constexpr bool MustUseTimedInvoke() { return false; }
};

struct DecodableType {
public:
  static constexpr CommandId GetCommandId() {
    return Commands::ApplyUpdateRequest::Id;
  }
  static constexpr ClusterId GetClusterId() {
    return Clusters::OtaSoftwareUpdateProvider::Id;
  }
  static constexpr bool kIsFabricScoped = false;

  chip::ByteSpan updateToken;
  uint32_t newVersion = static_cast<uint32_t>(0);

  CHIP_ERROR Decode(TLV::TLVReader &reader);
};
}; // namespace ApplyUpdateRequest
namespace ApplyUpdateResponse {
enum class Fields : uint8_t {
  kAction = 0,
  kDelayedActionTime = 1,
};

struct Type {
public:
  // Use GetCommandId instead of commandId directly to avoid naming conflict
  // with CommandIdentification in ExecutionOfACommand
  static constexpr CommandId GetCommandId() {
    return Commands::ApplyUpdateResponse::Id;
  }
  static constexpr ClusterId GetClusterId() {
    return Clusters::OtaSoftwareUpdateProvider::Id;
  }

  ApplyUpdateActionEnum action = static_cast<ApplyUpdateActionEnum>(0);
  uint32_t delayedActionTime = static_cast<uint32_t>(0);

  CHIP_ERROR Encode(DataModel::FabricAwareTLVWriter &aWriter,
                    TLV::Tag aTag) const;

  using ResponseType = DataModel::NullObjectType;

  static constexpr bool MustUseTimedInvoke() { return false; }
};

struct DecodableType {
public:
  static constexpr CommandId GetCommandId() {
    return Commands::ApplyUpdateResponse::Id;
  }
  static constexpr ClusterId GetClusterId() {
    return Clusters::OtaSoftwareUpdateProvider::Id;
  }

  ApplyUpdateActionEnum action = static_cast<ApplyUpdateActionEnum>(0);
  uint32_t delayedActionTime = static_cast<uint32_t>(0);

  CHIP_ERROR Decode(TLV::TLVReader &reader);
};
}; // namespace ApplyUpdateResponse
namespace NotifyUpdateApplied {
enum class Fields : uint8_t {
  kUpdateToken = 0,
  kSoftwareVersion = 1,
};

struct Type {
public:
  // Use GetCommandId instead of commandId directly to avoid naming conflict
  // with CommandIdentification in ExecutionOfACommand
  static constexpr CommandId GetCommandId() {
    return Commands::NotifyUpdateApplied::Id;
  }
  static constexpr ClusterId GetClusterId() {
    return Clusters::OtaSoftwareUpdateProvider::Id;
  }

  chip::ByteSpan updateToken;
  uint32_t softwareVersion = static_cast<uint32_t>(0);

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

  using ResponseType = DataModel::NullObjectType;

  static constexpr bool MustUseTimedInvoke() { return false; }
};

struct DecodableType {
public:
  static constexpr CommandId GetCommandId() {
    return Commands::NotifyUpdateApplied::Id;
  }
  static constexpr ClusterId GetClusterId() {
    return Clusters::OtaSoftwareUpdateProvider::Id;
  }
  static constexpr bool kIsFabricScoped = false;

  chip::ByteSpan updateToken;
  uint32_t softwareVersion = static_cast<uint32_t>(0);

  CHIP_ERROR Decode(TLV::TLVReader &reader);
};
}; // namespace NotifyUpdateApplied
} // namespace Commands
} // namespace OtaSoftwareUpdateProvider
} // namespace Clusters
} // namespace app
} // namespace chip
