<!--

    Copyright © 2016-2026 The Thingsboard 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.

-->
<section [formGroup]="renameKeysConfigForm" class="tb-form-panel stroked">
  <div class="tb-form-panel-title" translate>rule-node-config.rename-keys-in</div>
  <div class="fx-centered">
    <div class="fetch-to-data-toggle">
      <tb-toggle-select class="fetch-to-data-toggle" formControlName="renameIn" appearance="fill">
        @for (data of renameIn; track data) {
          <tb-toggle-option [value]="data.value">
            {{ data.name }}
          </tb-toggle-option>
        }
      </tb-toggle-select>
    </div>
  </div>
  <tb-kv-map-config
    required
    labelText="{{ translation.get(renameKeysConfigForm.get('renameIn').value) | translate }} {{'rule-node-config.keys-mapping' | translate}}"
    formControlName="renameKeysMapping"
    uniqueKeyValuePairValidator
    requiredText="{{'rule-node-config.attr-mapping-required' | translate}}"
    keyText="{{'rule-node-config.current-key-name' | translate}}"
    keyRequiredText="{{'rule-node-config.key-name-required' | translate}}"
    valText="{{'rule-node-config.new-key-name' | translate}}"
    valRequiredText="{{'rule-node-config.new-key-name-required' | translate}}">
  </tb-kv-map-config>
</section>
