# Copyright (c) 2024 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.
# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default

name: "[TC-ICDM-4.1] Stay Active Request with DUT as Server"

PICS:
    - ICDM.S
    - ICDM.S.F02

config:
    nodeId: 0x12344321
    cluster: "ICD Management"
    endpoint: 0

tests:
    - label: "Wait for the commissioned device to be retrieved"
      cluster: "DelayCommands"
      command: "WaitForCommissionee"
      arguments:
          values:
              - name: "nodeId"
                value: nodeId

    - label:
          "TH sends StayActiveRequest command with StayActiveDuration greater
          than or equal 30000 milliseconds."
      command: "StayActiveRequest"
      arguments:
          values:
              - name: "StayActiveDuration"
                value: 30000
      response:
          values:
              - name: "PromisedActiveDuration"
                saveAs: ActiveDuration
                constraints:
                    type: int32u
                    minValue: 29995

    - label: "Wait for the PromisedActiveDuration to end"
      cluster: "DelayCommands"
      command: "WaitForMs"
      arguments:
          values:
              - name: "ms"
                value: ActiveDuration

    - label:
          "TH sends StayActiveRequest command with StayActiveDuration less than
          30000 milliseconds."
      command: "StayActiveRequest"
      arguments:
          values:
              - name: "StayActiveDuration"
                value: 20000
      response:
          values:
              - name: "PromisedActiveDuration"
                constraints:
                    type: int32u
                    minValue: 19995
