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

#include <clusters/ColorControl/Commands.h>

#include <app/data-model/Decode.h>
#include <app/data-model/StructDecodeIterator.h>
#include <app/data-model/WrappedStructEncoder.h>

namespace chip {
namespace app {
namespace Clusters {
namespace ColorControl {
namespace Commands {
namespace MoveToHue {

CHIP_ERROR Type::Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const {
  DataModel::WrappedStructEncoder encoder{aWriter, aTag};
  encoder.Encode(to_underlying(Fields::kHue), hue);
  encoder.Encode(to_underlying(Fields::kDirection), direction);
  encoder.Encode(to_underlying(Fields::kTransitionTime), transitionTime);
  encoder.Encode(to_underlying(Fields::kOptionsMask), optionsMask);
  encoder.Encode(to_underlying(Fields::kOptionsOverride), optionsOverride);
  return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) {
  detail::StructDecodeIterator __iterator(reader);
  while (true) {
    uint8_t __context_tag = 0;
    CHIP_ERROR err = __iterator.Next(__context_tag);
    VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
    ReturnErrorOnFailure(err);

    if (__context_tag == to_underlying(Fields::kHue)) {
      err = DataModel::Decode(reader, hue);
    } else if (__context_tag == to_underlying(Fields::kDirection)) {
      err = DataModel::Decode(reader, direction);
    } else if (__context_tag == to_underlying(Fields::kTransitionTime)) {
      err = DataModel::Decode(reader, transitionTime);
    } else if (__context_tag == to_underlying(Fields::kOptionsMask)) {
      err = DataModel::Decode(reader, optionsMask);
    } else if (__context_tag == to_underlying(Fields::kOptionsOverride)) {
      err = DataModel::Decode(reader, optionsOverride);
    }

    ReturnErrorOnFailure(err);
  }
}
} // namespace MoveToHue.
namespace MoveHue {

CHIP_ERROR Type::Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const {
  DataModel::WrappedStructEncoder encoder{aWriter, aTag};
  encoder.Encode(to_underlying(Fields::kMoveMode), moveMode);
  encoder.Encode(to_underlying(Fields::kRate), rate);
  encoder.Encode(to_underlying(Fields::kOptionsMask), optionsMask);
  encoder.Encode(to_underlying(Fields::kOptionsOverride), optionsOverride);
  return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) {
  detail::StructDecodeIterator __iterator(reader);
  while (true) {
    uint8_t __context_tag = 0;
    CHIP_ERROR err = __iterator.Next(__context_tag);
    VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
    ReturnErrorOnFailure(err);

    if (__context_tag == to_underlying(Fields::kMoveMode)) {
      err = DataModel::Decode(reader, moveMode);
    } else if (__context_tag == to_underlying(Fields::kRate)) {
      err = DataModel::Decode(reader, rate);
    } else if (__context_tag == to_underlying(Fields::kOptionsMask)) {
      err = DataModel::Decode(reader, optionsMask);
    } else if (__context_tag == to_underlying(Fields::kOptionsOverride)) {
      err = DataModel::Decode(reader, optionsOverride);
    }

    ReturnErrorOnFailure(err);
  }
}
} // namespace MoveHue.
namespace StepHue {

CHIP_ERROR Type::Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const {
  DataModel::WrappedStructEncoder encoder{aWriter, aTag};
  encoder.Encode(to_underlying(Fields::kStepMode), stepMode);
  encoder.Encode(to_underlying(Fields::kStepSize), stepSize);
  encoder.Encode(to_underlying(Fields::kTransitionTime), transitionTime);
  encoder.Encode(to_underlying(Fields::kOptionsMask), optionsMask);
  encoder.Encode(to_underlying(Fields::kOptionsOverride), optionsOverride);
  return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) {
  detail::StructDecodeIterator __iterator(reader);
  while (true) {
    uint8_t __context_tag = 0;
    CHIP_ERROR err = __iterator.Next(__context_tag);
    VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
    ReturnErrorOnFailure(err);

    if (__context_tag == to_underlying(Fields::kStepMode)) {
      err = DataModel::Decode(reader, stepMode);
    } else if (__context_tag == to_underlying(Fields::kStepSize)) {
      err = DataModel::Decode(reader, stepSize);
    } else if (__context_tag == to_underlying(Fields::kTransitionTime)) {
      err = DataModel::Decode(reader, transitionTime);
    } else if (__context_tag == to_underlying(Fields::kOptionsMask)) {
      err = DataModel::Decode(reader, optionsMask);
    } else if (__context_tag == to_underlying(Fields::kOptionsOverride)) {
      err = DataModel::Decode(reader, optionsOverride);
    }

    ReturnErrorOnFailure(err);
  }
}
} // namespace StepHue.
namespace MoveToSaturation {

CHIP_ERROR Type::Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const {
  DataModel::WrappedStructEncoder encoder{aWriter, aTag};
  encoder.Encode(to_underlying(Fields::kSaturation), saturation);
  encoder.Encode(to_underlying(Fields::kTransitionTime), transitionTime);
  encoder.Encode(to_underlying(Fields::kOptionsMask), optionsMask);
  encoder.Encode(to_underlying(Fields::kOptionsOverride), optionsOverride);
  return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) {
  detail::StructDecodeIterator __iterator(reader);
  while (true) {
    uint8_t __context_tag = 0;
    CHIP_ERROR err = __iterator.Next(__context_tag);
    VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
    ReturnErrorOnFailure(err);

    if (__context_tag == to_underlying(Fields::kSaturation)) {
      err = DataModel::Decode(reader, saturation);
    } else if (__context_tag == to_underlying(Fields::kTransitionTime)) {
      err = DataModel::Decode(reader, transitionTime);
    } else if (__context_tag == to_underlying(Fields::kOptionsMask)) {
      err = DataModel::Decode(reader, optionsMask);
    } else if (__context_tag == to_underlying(Fields::kOptionsOverride)) {
      err = DataModel::Decode(reader, optionsOverride);
    }

    ReturnErrorOnFailure(err);
  }
}
} // namespace MoveToSaturation.
namespace MoveSaturation {

CHIP_ERROR Type::Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const {
  DataModel::WrappedStructEncoder encoder{aWriter, aTag};
  encoder.Encode(to_underlying(Fields::kMoveMode), moveMode);
  encoder.Encode(to_underlying(Fields::kRate), rate);
  encoder.Encode(to_underlying(Fields::kOptionsMask), optionsMask);
  encoder.Encode(to_underlying(Fields::kOptionsOverride), optionsOverride);
  return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) {
  detail::StructDecodeIterator __iterator(reader);
  while (true) {
    uint8_t __context_tag = 0;
    CHIP_ERROR err = __iterator.Next(__context_tag);
    VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
    ReturnErrorOnFailure(err);

    if (__context_tag == to_underlying(Fields::kMoveMode)) {
      err = DataModel::Decode(reader, moveMode);
    } else if (__context_tag == to_underlying(Fields::kRate)) {
      err = DataModel::Decode(reader, rate);
    } else if (__context_tag == to_underlying(Fields::kOptionsMask)) {
      err = DataModel::Decode(reader, optionsMask);
    } else if (__context_tag == to_underlying(Fields::kOptionsOverride)) {
      err = DataModel::Decode(reader, optionsOverride);
    }

    ReturnErrorOnFailure(err);
  }
}
} // namespace MoveSaturation.
namespace StepSaturation {

CHIP_ERROR Type::Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const {
  DataModel::WrappedStructEncoder encoder{aWriter, aTag};
  encoder.Encode(to_underlying(Fields::kStepMode), stepMode);
  encoder.Encode(to_underlying(Fields::kStepSize), stepSize);
  encoder.Encode(to_underlying(Fields::kTransitionTime), transitionTime);
  encoder.Encode(to_underlying(Fields::kOptionsMask), optionsMask);
  encoder.Encode(to_underlying(Fields::kOptionsOverride), optionsOverride);
  return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) {
  detail::StructDecodeIterator __iterator(reader);
  while (true) {
    uint8_t __context_tag = 0;
    CHIP_ERROR err = __iterator.Next(__context_tag);
    VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
    ReturnErrorOnFailure(err);

    if (__context_tag == to_underlying(Fields::kStepMode)) {
      err = DataModel::Decode(reader, stepMode);
    } else if (__context_tag == to_underlying(Fields::kStepSize)) {
      err = DataModel::Decode(reader, stepSize);
    } else if (__context_tag == to_underlying(Fields::kTransitionTime)) {
      err = DataModel::Decode(reader, transitionTime);
    } else if (__context_tag == to_underlying(Fields::kOptionsMask)) {
      err = DataModel::Decode(reader, optionsMask);
    } else if (__context_tag == to_underlying(Fields::kOptionsOverride)) {
      err = DataModel::Decode(reader, optionsOverride);
    }

    ReturnErrorOnFailure(err);
  }
}
} // namespace StepSaturation.
namespace MoveToHueAndSaturation {

CHIP_ERROR Type::Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const {
  DataModel::WrappedStructEncoder encoder{aWriter, aTag};
  encoder.Encode(to_underlying(Fields::kHue), hue);
  encoder.Encode(to_underlying(Fields::kSaturation), saturation);
  encoder.Encode(to_underlying(Fields::kTransitionTime), transitionTime);
  encoder.Encode(to_underlying(Fields::kOptionsMask), optionsMask);
  encoder.Encode(to_underlying(Fields::kOptionsOverride), optionsOverride);
  return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) {
  detail::StructDecodeIterator __iterator(reader);
  while (true) {
    uint8_t __context_tag = 0;
    CHIP_ERROR err = __iterator.Next(__context_tag);
    VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
    ReturnErrorOnFailure(err);

    if (__context_tag == to_underlying(Fields::kHue)) {
      err = DataModel::Decode(reader, hue);
    } else if (__context_tag == to_underlying(Fields::kSaturation)) {
      err = DataModel::Decode(reader, saturation);
    } else if (__context_tag == to_underlying(Fields::kTransitionTime)) {
      err = DataModel::Decode(reader, transitionTime);
    } else if (__context_tag == to_underlying(Fields::kOptionsMask)) {
      err = DataModel::Decode(reader, optionsMask);
    } else if (__context_tag == to_underlying(Fields::kOptionsOverride)) {
      err = DataModel::Decode(reader, optionsOverride);
    }

    ReturnErrorOnFailure(err);
  }
}
} // namespace MoveToHueAndSaturation.
namespace MoveToColor {

CHIP_ERROR Type::Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const {
  DataModel::WrappedStructEncoder encoder{aWriter, aTag};
  encoder.Encode(to_underlying(Fields::kColorX), colorX);
  encoder.Encode(to_underlying(Fields::kColorY), colorY);
  encoder.Encode(to_underlying(Fields::kTransitionTime), transitionTime);
  encoder.Encode(to_underlying(Fields::kOptionsMask), optionsMask);
  encoder.Encode(to_underlying(Fields::kOptionsOverride), optionsOverride);
  return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) {
  detail::StructDecodeIterator __iterator(reader);
  while (true) {
    uint8_t __context_tag = 0;
    CHIP_ERROR err = __iterator.Next(__context_tag);
    VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
    ReturnErrorOnFailure(err);

    if (__context_tag == to_underlying(Fields::kColorX)) {
      err = DataModel::Decode(reader, colorX);
    } else if (__context_tag == to_underlying(Fields::kColorY)) {
      err = DataModel::Decode(reader, colorY);
    } else if (__context_tag == to_underlying(Fields::kTransitionTime)) {
      err = DataModel::Decode(reader, transitionTime);
    } else if (__context_tag == to_underlying(Fields::kOptionsMask)) {
      err = DataModel::Decode(reader, optionsMask);
    } else if (__context_tag == to_underlying(Fields::kOptionsOverride)) {
      err = DataModel::Decode(reader, optionsOverride);
    }

    ReturnErrorOnFailure(err);
  }
}
} // namespace MoveToColor.
namespace MoveColor {

CHIP_ERROR Type::Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const {
  DataModel::WrappedStructEncoder encoder{aWriter, aTag};
  encoder.Encode(to_underlying(Fields::kRateX), rateX);
  encoder.Encode(to_underlying(Fields::kRateY), rateY);
  encoder.Encode(to_underlying(Fields::kOptionsMask), optionsMask);
  encoder.Encode(to_underlying(Fields::kOptionsOverride), optionsOverride);
  return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) {
  detail::StructDecodeIterator __iterator(reader);
  while (true) {
    uint8_t __context_tag = 0;
    CHIP_ERROR err = __iterator.Next(__context_tag);
    VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
    ReturnErrorOnFailure(err);

    if (__context_tag == to_underlying(Fields::kRateX)) {
      err = DataModel::Decode(reader, rateX);
    } else if (__context_tag == to_underlying(Fields::kRateY)) {
      err = DataModel::Decode(reader, rateY);
    } else if (__context_tag == to_underlying(Fields::kOptionsMask)) {
      err = DataModel::Decode(reader, optionsMask);
    } else if (__context_tag == to_underlying(Fields::kOptionsOverride)) {
      err = DataModel::Decode(reader, optionsOverride);
    }

    ReturnErrorOnFailure(err);
  }
}
} // namespace MoveColor.
namespace StepColor {

CHIP_ERROR Type::Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const {
  DataModel::WrappedStructEncoder encoder{aWriter, aTag};
  encoder.Encode(to_underlying(Fields::kStepX), stepX);
  encoder.Encode(to_underlying(Fields::kStepY), stepY);
  encoder.Encode(to_underlying(Fields::kTransitionTime), transitionTime);
  encoder.Encode(to_underlying(Fields::kOptionsMask), optionsMask);
  encoder.Encode(to_underlying(Fields::kOptionsOverride), optionsOverride);
  return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) {
  detail::StructDecodeIterator __iterator(reader);
  while (true) {
    uint8_t __context_tag = 0;
    CHIP_ERROR err = __iterator.Next(__context_tag);
    VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
    ReturnErrorOnFailure(err);

    if (__context_tag == to_underlying(Fields::kStepX)) {
      err = DataModel::Decode(reader, stepX);
    } else if (__context_tag == to_underlying(Fields::kStepY)) {
      err = DataModel::Decode(reader, stepY);
    } else if (__context_tag == to_underlying(Fields::kTransitionTime)) {
      err = DataModel::Decode(reader, transitionTime);
    } else if (__context_tag == to_underlying(Fields::kOptionsMask)) {
      err = DataModel::Decode(reader, optionsMask);
    } else if (__context_tag == to_underlying(Fields::kOptionsOverride)) {
      err = DataModel::Decode(reader, optionsOverride);
    }

    ReturnErrorOnFailure(err);
  }
}
} // namespace StepColor.
namespace MoveToColorTemperature {

CHIP_ERROR Type::Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const {
  DataModel::WrappedStructEncoder encoder{aWriter, aTag};
  encoder.Encode(to_underlying(Fields::kColorTemperatureMireds),
                 colorTemperatureMireds);
  encoder.Encode(to_underlying(Fields::kTransitionTime), transitionTime);
  encoder.Encode(to_underlying(Fields::kOptionsMask), optionsMask);
  encoder.Encode(to_underlying(Fields::kOptionsOverride), optionsOverride);
  return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) {
  detail::StructDecodeIterator __iterator(reader);
  while (true) {
    uint8_t __context_tag = 0;
    CHIP_ERROR err = __iterator.Next(__context_tag);
    VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
    ReturnErrorOnFailure(err);

    if (__context_tag == to_underlying(Fields::kColorTemperatureMireds)) {
      err = DataModel::Decode(reader, colorTemperatureMireds);
    } else if (__context_tag == to_underlying(Fields::kTransitionTime)) {
      err = DataModel::Decode(reader, transitionTime);
    } else if (__context_tag == to_underlying(Fields::kOptionsMask)) {
      err = DataModel::Decode(reader, optionsMask);
    } else if (__context_tag == to_underlying(Fields::kOptionsOverride)) {
      err = DataModel::Decode(reader, optionsOverride);
    }

    ReturnErrorOnFailure(err);
  }
}
} // namespace MoveToColorTemperature.
namespace EnhancedMoveToHue {

CHIP_ERROR Type::Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const {
  DataModel::WrappedStructEncoder encoder{aWriter, aTag};
  encoder.Encode(to_underlying(Fields::kEnhancedHue), enhancedHue);
  encoder.Encode(to_underlying(Fields::kDirection), direction);
  encoder.Encode(to_underlying(Fields::kTransitionTime), transitionTime);
  encoder.Encode(to_underlying(Fields::kOptionsMask), optionsMask);
  encoder.Encode(to_underlying(Fields::kOptionsOverride), optionsOverride);
  return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) {
  detail::StructDecodeIterator __iterator(reader);
  while (true) {
    uint8_t __context_tag = 0;
    CHIP_ERROR err = __iterator.Next(__context_tag);
    VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
    ReturnErrorOnFailure(err);

    if (__context_tag == to_underlying(Fields::kEnhancedHue)) {
      err = DataModel::Decode(reader, enhancedHue);
    } else if (__context_tag == to_underlying(Fields::kDirection)) {
      err = DataModel::Decode(reader, direction);
    } else if (__context_tag == to_underlying(Fields::kTransitionTime)) {
      err = DataModel::Decode(reader, transitionTime);
    } else if (__context_tag == to_underlying(Fields::kOptionsMask)) {
      err = DataModel::Decode(reader, optionsMask);
    } else if (__context_tag == to_underlying(Fields::kOptionsOverride)) {
      err = DataModel::Decode(reader, optionsOverride);
    }

    ReturnErrorOnFailure(err);
  }
}
} // namespace EnhancedMoveToHue.
namespace EnhancedMoveHue {

CHIP_ERROR Type::Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const {
  DataModel::WrappedStructEncoder encoder{aWriter, aTag};
  encoder.Encode(to_underlying(Fields::kMoveMode), moveMode);
  encoder.Encode(to_underlying(Fields::kRate), rate);
  encoder.Encode(to_underlying(Fields::kOptionsMask), optionsMask);
  encoder.Encode(to_underlying(Fields::kOptionsOverride), optionsOverride);
  return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) {
  detail::StructDecodeIterator __iterator(reader);
  while (true) {
    uint8_t __context_tag = 0;
    CHIP_ERROR err = __iterator.Next(__context_tag);
    VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
    ReturnErrorOnFailure(err);

    if (__context_tag == to_underlying(Fields::kMoveMode)) {
      err = DataModel::Decode(reader, moveMode);
    } else if (__context_tag == to_underlying(Fields::kRate)) {
      err = DataModel::Decode(reader, rate);
    } else if (__context_tag == to_underlying(Fields::kOptionsMask)) {
      err = DataModel::Decode(reader, optionsMask);
    } else if (__context_tag == to_underlying(Fields::kOptionsOverride)) {
      err = DataModel::Decode(reader, optionsOverride);
    }

    ReturnErrorOnFailure(err);
  }
}
} // namespace EnhancedMoveHue.
namespace EnhancedStepHue {

CHIP_ERROR Type::Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const {
  DataModel::WrappedStructEncoder encoder{aWriter, aTag};
  encoder.Encode(to_underlying(Fields::kStepMode), stepMode);
  encoder.Encode(to_underlying(Fields::kStepSize), stepSize);
  encoder.Encode(to_underlying(Fields::kTransitionTime), transitionTime);
  encoder.Encode(to_underlying(Fields::kOptionsMask), optionsMask);
  encoder.Encode(to_underlying(Fields::kOptionsOverride), optionsOverride);
  return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) {
  detail::StructDecodeIterator __iterator(reader);
  while (true) {
    uint8_t __context_tag = 0;
    CHIP_ERROR err = __iterator.Next(__context_tag);
    VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
    ReturnErrorOnFailure(err);

    if (__context_tag == to_underlying(Fields::kStepMode)) {
      err = DataModel::Decode(reader, stepMode);
    } else if (__context_tag == to_underlying(Fields::kStepSize)) {
      err = DataModel::Decode(reader, stepSize);
    } else if (__context_tag == to_underlying(Fields::kTransitionTime)) {
      err = DataModel::Decode(reader, transitionTime);
    } else if (__context_tag == to_underlying(Fields::kOptionsMask)) {
      err = DataModel::Decode(reader, optionsMask);
    } else if (__context_tag == to_underlying(Fields::kOptionsOverride)) {
      err = DataModel::Decode(reader, optionsOverride);
    }

    ReturnErrorOnFailure(err);
  }
}
} // namespace EnhancedStepHue.
namespace EnhancedMoveToHueAndSaturation {

CHIP_ERROR Type::Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const {
  DataModel::WrappedStructEncoder encoder{aWriter, aTag};
  encoder.Encode(to_underlying(Fields::kEnhancedHue), enhancedHue);
  encoder.Encode(to_underlying(Fields::kSaturation), saturation);
  encoder.Encode(to_underlying(Fields::kTransitionTime), transitionTime);
  encoder.Encode(to_underlying(Fields::kOptionsMask), optionsMask);
  encoder.Encode(to_underlying(Fields::kOptionsOverride), optionsOverride);
  return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) {
  detail::StructDecodeIterator __iterator(reader);
  while (true) {
    uint8_t __context_tag = 0;
    CHIP_ERROR err = __iterator.Next(__context_tag);
    VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
    ReturnErrorOnFailure(err);

    if (__context_tag == to_underlying(Fields::kEnhancedHue)) {
      err = DataModel::Decode(reader, enhancedHue);
    } else if (__context_tag == to_underlying(Fields::kSaturation)) {
      err = DataModel::Decode(reader, saturation);
    } else if (__context_tag == to_underlying(Fields::kTransitionTime)) {
      err = DataModel::Decode(reader, transitionTime);
    } else if (__context_tag == to_underlying(Fields::kOptionsMask)) {
      err = DataModel::Decode(reader, optionsMask);
    } else if (__context_tag == to_underlying(Fields::kOptionsOverride)) {
      err = DataModel::Decode(reader, optionsOverride);
    }

    ReturnErrorOnFailure(err);
  }
}
} // namespace EnhancedMoveToHueAndSaturation.
namespace ColorLoopSet {

CHIP_ERROR Type::Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const {
  DataModel::WrappedStructEncoder encoder{aWriter, aTag};
  encoder.Encode(to_underlying(Fields::kUpdateFlags), updateFlags);
  encoder.Encode(to_underlying(Fields::kAction), action);
  encoder.Encode(to_underlying(Fields::kDirection), direction);
  encoder.Encode(to_underlying(Fields::kTime), time);
  encoder.Encode(to_underlying(Fields::kStartHue), startHue);
  encoder.Encode(to_underlying(Fields::kOptionsMask), optionsMask);
  encoder.Encode(to_underlying(Fields::kOptionsOverride), optionsOverride);
  return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) {
  detail::StructDecodeIterator __iterator(reader);
  while (true) {
    uint8_t __context_tag = 0;
    CHIP_ERROR err = __iterator.Next(__context_tag);
    VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
    ReturnErrorOnFailure(err);

    if (__context_tag == to_underlying(Fields::kUpdateFlags)) {
      err = DataModel::Decode(reader, updateFlags);
    } else if (__context_tag == to_underlying(Fields::kAction)) {
      err = DataModel::Decode(reader, action);
    } else if (__context_tag == to_underlying(Fields::kDirection)) {
      err = DataModel::Decode(reader, direction);
    } else if (__context_tag == to_underlying(Fields::kTime)) {
      err = DataModel::Decode(reader, time);
    } else if (__context_tag == to_underlying(Fields::kStartHue)) {
      err = DataModel::Decode(reader, startHue);
    } else if (__context_tag == to_underlying(Fields::kOptionsMask)) {
      err = DataModel::Decode(reader, optionsMask);
    } else if (__context_tag == to_underlying(Fields::kOptionsOverride)) {
      err = DataModel::Decode(reader, optionsOverride);
    }

    ReturnErrorOnFailure(err);
  }
}
} // namespace ColorLoopSet.
namespace StopMoveStep {

CHIP_ERROR Type::Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const {
  DataModel::WrappedStructEncoder encoder{aWriter, aTag};
  encoder.Encode(to_underlying(Fields::kOptionsMask), optionsMask);
  encoder.Encode(to_underlying(Fields::kOptionsOverride), optionsOverride);
  return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) {
  detail::StructDecodeIterator __iterator(reader);
  while (true) {
    uint8_t __context_tag = 0;
    CHIP_ERROR err = __iterator.Next(__context_tag);
    VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
    ReturnErrorOnFailure(err);

    if (__context_tag == to_underlying(Fields::kOptionsMask)) {
      err = DataModel::Decode(reader, optionsMask);
    } else if (__context_tag == to_underlying(Fields::kOptionsOverride)) {
      err = DataModel::Decode(reader, optionsOverride);
    }

    ReturnErrorOnFailure(err);
  }
}
} // namespace StopMoveStep.
namespace MoveColorTemperature {

CHIP_ERROR Type::Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const {
  DataModel::WrappedStructEncoder encoder{aWriter, aTag};
  encoder.Encode(to_underlying(Fields::kMoveMode), moveMode);
  encoder.Encode(to_underlying(Fields::kRate), rate);
  encoder.Encode(to_underlying(Fields::kColorTemperatureMinimumMireds),
                 colorTemperatureMinimumMireds);
  encoder.Encode(to_underlying(Fields::kColorTemperatureMaximumMireds),
                 colorTemperatureMaximumMireds);
  encoder.Encode(to_underlying(Fields::kOptionsMask), optionsMask);
  encoder.Encode(to_underlying(Fields::kOptionsOverride), optionsOverride);
  return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) {
  detail::StructDecodeIterator __iterator(reader);
  while (true) {
    uint8_t __context_tag = 0;
    CHIP_ERROR err = __iterator.Next(__context_tag);
    VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
    ReturnErrorOnFailure(err);

    if (__context_tag == to_underlying(Fields::kMoveMode)) {
      err = DataModel::Decode(reader, moveMode);
    } else if (__context_tag == to_underlying(Fields::kRate)) {
      err = DataModel::Decode(reader, rate);
    } else if (__context_tag ==
               to_underlying(Fields::kColorTemperatureMinimumMireds)) {
      err = DataModel::Decode(reader, colorTemperatureMinimumMireds);
    } else if (__context_tag ==
               to_underlying(Fields::kColorTemperatureMaximumMireds)) {
      err = DataModel::Decode(reader, colorTemperatureMaximumMireds);
    } else if (__context_tag == to_underlying(Fields::kOptionsMask)) {
      err = DataModel::Decode(reader, optionsMask);
    } else if (__context_tag == to_underlying(Fields::kOptionsOverride)) {
      err = DataModel::Decode(reader, optionsOverride);
    }

    ReturnErrorOnFailure(err);
  }
}
} // namespace MoveColorTemperature.
namespace StepColorTemperature {

CHIP_ERROR Type::Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const {
  DataModel::WrappedStructEncoder encoder{aWriter, aTag};
  encoder.Encode(to_underlying(Fields::kStepMode), stepMode);
  encoder.Encode(to_underlying(Fields::kStepSize), stepSize);
  encoder.Encode(to_underlying(Fields::kTransitionTime), transitionTime);
  encoder.Encode(to_underlying(Fields::kColorTemperatureMinimumMireds),
                 colorTemperatureMinimumMireds);
  encoder.Encode(to_underlying(Fields::kColorTemperatureMaximumMireds),
                 colorTemperatureMaximumMireds);
  encoder.Encode(to_underlying(Fields::kOptionsMask), optionsMask);
  encoder.Encode(to_underlying(Fields::kOptionsOverride), optionsOverride);
  return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) {
  detail::StructDecodeIterator __iterator(reader);
  while (true) {
    uint8_t __context_tag = 0;
    CHIP_ERROR err = __iterator.Next(__context_tag);
    VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
    ReturnErrorOnFailure(err);

    if (__context_tag == to_underlying(Fields::kStepMode)) {
      err = DataModel::Decode(reader, stepMode);
    } else if (__context_tag == to_underlying(Fields::kStepSize)) {
      err = DataModel::Decode(reader, stepSize);
    } else if (__context_tag == to_underlying(Fields::kTransitionTime)) {
      err = DataModel::Decode(reader, transitionTime);
    } else if (__context_tag ==
               to_underlying(Fields::kColorTemperatureMinimumMireds)) {
      err = DataModel::Decode(reader, colorTemperatureMinimumMireds);
    } else if (__context_tag ==
               to_underlying(Fields::kColorTemperatureMaximumMireds)) {
      err = DataModel::Decode(reader, colorTemperatureMaximumMireds);
    } else if (__context_tag == to_underlying(Fields::kOptionsMask)) {
      err = DataModel::Decode(reader, optionsMask);
    } else if (__context_tag == to_underlying(Fields::kOptionsOverride)) {
      err = DataModel::Decode(reader, optionsOverride);
    }

    ReturnErrorOnFailure(err);
  }
}
} // namespace StepColorTemperature.
} // namespace Commands
} // namespace ColorControl
} // namespace Clusters
} // namespace app
} // namespace chip
