<?xml version="1.0"?>
<cli>
  <group id="plugin-prepayment-server" name="Plugin Commands: Prepayment Server">
    <description>
      The prepayment server handles all implemented commands of the prepayment cluster server. 
    </description>
  </group>
  <!--command cli="plugin prepayment-server changePaymentModeRelative" functionName="emAfPrepaymentServerCliChangePaymentModeRelative" group="plugin-prepayment-server">
    <description>
      Send a change payment mode request with a future time offset relative to now.
    </description>
    <arg name="providerId"    type="INT32U" description="Identity of the commodity supplier." />
    <arg name="issuerEventId" type="INT32U" description="Unique identifier generated by commodity provider." />
    <arg name="implementationOffsetSeconds"  type="INT32U" description="Number of seconds after NOW when the change should take effect." />
    <arg name="proposedPaymentControlConfiguration" type="INT16U" description="16-bit bitmap indicating the actions required when switching the payment mode." />
    <arg name="cutOffValue"   type="INT32U" description="The value of the cut off value attribute." />
  </command -->
  <command cli="plugin prepayment-server writeAttribute" functionName="emAfPrepaymentServerCliWriteAttribute" group="plugin-prepayment-server">
    <description>
      Write the value of a local prepayment attribute (1-4 byte attribute value supported).
    </description>
    <arg name="endpoint"      type="INT8U"  description="Endpoint whose prepayment attribute is being written." />
    <arg name="attributeId"   type="INT16U" description="The attribute ID that should be written." />
    <arg name="attributeType" type="INT8U"  description="The attribute type (eg 0x23=U32)" />
    <arg name="numBytes"      type="INT8U"  description="The number of bytes (1-4) of data to write." />
    <arg name="value"         type="INT32U" description="The data that should be written to the attribute." />
  </command>
  <command cli="plugin prepayment-server verifyPaymentMode" functionName="emAfPrepaymentServerCliVerifyPaymentMode" group="plugin-prepayment-server">
    <description>
      Verify the payment mode matches an expected payment mode value.
    </description>
    <arg name="endpoint" type="INT8U" description="Metering endpoint whose payment mode value is being queried." />
    <arg name="expectedPaymentModeValue" type="INT16U" description="Expected payment mode value." />
  </command>
  <command cli="plugin prepayment-server verifyAttribute" functionName="emAfPrepaymentServerCliVerifyAttribute" group="plugin-prepayment-server">
    <description>
      Verify the prepayment attribute value matches an expected value.
    </description>
    <arg name="endpoint" type="INT8U" description="Metering endpoint whose payment mode value is being queried." />
    <arg name="attributeId" type="INT16U" description="Attribute ID of the attribute that will be verified." />
    <arg name="attributeSize" type="INT8U" description="Size of the attribute in bytes." />
    <arg name="expectedAttributeValue" type="INT32U" description="Expected payment mode value." />
  </command>
  <command cli="plugin prepayment-server publishPrepaySnapshot" functionName="emAfPrepaymentServerCliPublishPrepaySnapshot" group="plugin-prepayment-server">
    <description>
      Send the publish prepay snapshot command.
    </description>
    <arg name="nodeId"              type="INT16U" description="NodeId of the destination device" />
    <arg name="srcEndpoint"         type="INT8U"  description="The source endpoint of the sending device" />
    <arg name="dstEndpoint"         type="INT8U"  description="The destination endpoint of the receiving device" />
    <arg name="snapshotTableIndex"  type="INT32U" description="A unique identifier assigned by the device creating the snapshot" />
  </command>
  <command cli="plugin prepayment-server init" functionName="emAfPrepaymentServerCliInit" group="plugin-prepayment-server">
    <description>
      Initialize the prepayment server and snapshot table.
    </description>
    <arg name="endpoint"    type="INT8U"  description="Endpoint of the prepayment server." />
  </command>
  <command cli="plugin prepayment-server addSnapshotEvent" functionName="emAfPrepaymentServerCliAddSnapshotEvent" group="plugin-prepayment-server">
    <description>
      Add a snapshot event to the prepayment server.
    </description>
    <arg name="endpoint"        type="INT8U"   description="Endpoint of the device from which the snapshot will be taken" />
    <arg name="snapshotCause"   type="INT32U"   description="A bitmask indicating the cause of the snapshot" />
  </command>
  <command cli="plugin prepayment-server readDebtLog" functionName="emAfPrepaymentReadDebtLog" group="plugin-prepayment-server">
    <description>
      Read the values from the debt log from a specified index.
    </description>
    <arg name="index"     type="INT8U"  description="The index of the debt log to read." />
  </command>
  <command cli="plugin prepayment-server readDebtAttribs" functionName="emAfPrepaymentReadDebtAttributes" group="plugin-prepayment-server">
    <description>
      Read the values from the debt attribute set for a given index (1,2,3).
    </description>
    <arg name="endpoint"  type="INT8U"  description="The endpoint from which the debt attribute set will be read." />
    <arg name="index"     type="INT8U"  description="The index of the debt attribute set to read - 1, 2, or 3." />
  </command>
  <command cli="plugin prepayment-server getTopUpPercent" functionName="emAfPrepaymentGetTopUpPercentage" group="plugin-prepayment-server">
    <description>
      Determine the total top up percentage required for debt reduction.
    </description>
    <arg name="endpoint"    type="INT8U"   description="The endpoint from which the debt attribute set will be read." />
    <arg name="topUpValue"  type="INT32U"  description="The current top up value from which a percentage may be required for debt reduction"/>
  </command>
  <command cli="plugin prepayment-server checkCalendar" functionName="emAfPrepaymentCheckCalendarCli" group="plugin-prepayment-server">
    <description>
      Check that UTC time and calendar dates can be interchanged correctly.
    </description>
    <arg name="utcTime"    type="INT32U"   description="The UTC time that should be tested." />
  </command>

  <command cli="plugin prepayment-server getWeekdayFromUtc" functionName="emAfPrepaymentGetWeekdayCli" group="plugin-prepayment-server">
    <description>
      Read the day of the week for a given UTC time.
    </description>
    <arg name="utcTime"    type="INT32U"   description="The UTC time that should be converted." />
  </command>

  <command cli="plugin prepayment-server schedDebtRepay" functionName="emAfPrepaymentScheduleDebtRepaymentCli" group="plugin-prepayment-server">
    <description>
      Check that debt repayment handling correctly calculates and schedules various attributes.
    </description>
    <arg name="endpoint"    type="INT8U"  description="The endpoint of the prepayment server." />
    <arg name="issuerEvtId" type="INT32U" description="The issuer event ID for the debt." />
    <arg name="debtType"    type="INT8U"  description="The type of debt (0,1,2) that will be set." />
    <arg name="collectTime" type="INT16U" description="The time in mins from midnight when the debt should be collected." />
    <arg name="startTime"   type="INT32U" description="The starting UTC time when debt should be collected." />
    <arg name="collectFreq" type="INT8U"  description="The frequency at which debt should be collected.  0=hourly, 1=daily, 2=weekly, 3=monthly, 4=quarterly." />
  </command>
</cli>

