<!--

    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 class="flex flex-col" [formGroup]="relationsQueryFormGroup">
  <mat-checkbox formControlName="fetchLastLevelOnly">
    {{ 'alias.last-level-relation' | translate }}
  </mat-checkbox>
  <div class="flex flex-row gap-2">
    <mat-form-field class="mat-block" style="min-width: 100px;">
      <mat-label translate>relation.direction</mat-label>
      <mat-select required matInput formControlName="direction">
        @for (type of directionTypes; track type) {
          <mat-option [value]="type">
            {{ directionTypeTranslations.get(type) | translate }}
          </mat-option>
        }
      </mat-select>
    </mat-form-field>
    <mat-form-field floatLabel="always" class="mat-block flex-1">
      <mat-label translate>rule-node-config.max-relation-level</mat-label>
      <input matInput
             type="number"
             min="1"
             step="1"
             placeholder="{{ 'rule-node-config.unlimited-level' | translate }}"
             formControlName="maxLevel">
    </mat-form-field>
  </div>
  <div class="mat-caption" style="color: #6e6e6e;" translate>relation.relation-filters</div>
  <tb-relation-filters
    formControlName="filters"
  ></tb-relation-filters>
</section>
