/*
  E1.37-7.h.h

  Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in all
  copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/
#pragma once

#include <cstdint>

/**
 * @brief ANSI E1.37-7
 * Additional Message Sets for ANSI E1.20 (RDM) -
 * Gateway & Splitter Configuration Messages
 */
namespace RDM {
  using PID = uint16_t;

  /// Appendix A: Defined Parameters (Normative)

  /// Table A-1: RDM Parameter ID
  static const PID ENDPOINT_LIST                                = 0x0900;
  static const PID ENDPOINT_LIST_CHANGE                         = 0x0901;
  static const PID IDENTIFY_ENDPOINT                            = 0x0902;
  static const PID ENDPOINT_TO_UNIVERSE                         = 0x0903;
  static const PID ENDPOINT_MODE                                = 0x0904;
  static const PID ENDPOINT_LABEL                               = 0x0905;
  static const PID RDM_TRAFFIC_ENABLE                           = 0x0906;
  static const PID DISCOVERY_STATE                              = 0x0907;
  static const PID BACKGROUND_DISCOVERY                         = 0x0908;
  static const PID ENDPOINT_TIMING                              = 0x0909;
  static const PID ENDPOINT_TIMING_DESCRIPTION                  = 0x090A;
  static const PID ENDPOINT_RESPONDERS                          = 0x090B;
  static const PID ENDPOINT_RESPONDER_LIST_CHANGE               = 0x090C;
  static const PID BINDING_CONTROL_FIELDS                       = 0x090D;
  static const PID BACKGROUND_QUEUED_STATUS_POLICY              = 0x090E;
  static const PID BACKGROUND_QUEUED_STATUS_POLICY_DESCRIPTION  = 0x090F;

  /// Table A-2: Discovery State
  static const uint8_t DISCOVERY_INCOMPLETE   = 0x00;
  static const uint8_t DISCOVERY_INCREMENTAL  = 0x01;
  static const uint8_t DISCOVERY_FULL         = 0x02;
  static const uint8_t DISCOVERY_NOT_ACTIVE   = 0x04;

  /// Table A-3: Discovery Status
  static const uint16_t DISCOVERY_COUNT_INCOMPLETE  = 0x0000;
  static const uint16_t DISCOVERY_COUNT_UNKNOWN     = 0xFFFF;

  /// Table A-4: Endpoint Mode
  static const uint8_t ENDPOINT_MODE_DISABLED = 0x00;
  static const uint8_t ENDPOINT_MODE_INPUT    = 0x01;
  static const uint8_t ENDPOINT_MODE_OUTPUT   = 0x02;

  /// Table A-5: Endpoint Types
  static const uint8_t ENDPOINT_TYPE_VIRTUAL  = 0x00;
  static const uint8_t ENDPOINT_TYPE_PHYSICAL = 0x01;

  /// Table A-6: Additional Response NACK Reason Codes
  static const uint16_t NR_ACTION_NOT_SUPPORTED     = 0x000B; // also defined in E1.37-2
  static const uint16_t NR_ENDPOINT_NUMBER_INVALID  = 0x000C;
  static const uint16_t NR_INVALID_ENDPOINT_MODE    = 0x000D;
  static const uint16_t NR_UNKNOWN_UID              = 0x000E;

} // namespace RDM
