<!--

    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.

-->
<ng-container [formGroup]="knobControlWidgetSettingsForm">
  <div class="tb-form-panel">
    <div class="tb-form-panel-title" translate>widgets.knob.behavior</div>
    <div class="tb-form-row">
      <div class="fixed-title-width" tb-hint-tooltip-icon="{{'widgets.knob.initial-value-hint' | translate}}" translate>widgets.knob.initial-value</div>
      <tb-get-value-action-settings class="flex-1"
                                    panelTitle="{{ 'widgets.knob.initial-value' | translate }}"
                                    [valueType]="valueType.DOUBLE"
                                    [aliasController]="aliasController"
                                    [targetDevice]="targetDevice"
                                    [widgetType]="widgetType"
                                    formControlName="initialState"></tb-get-value-action-settings>
    </div>
    <div class="tb-form-row space-between">
      <div class="fixed-title-width" tb-hint-tooltip-icon="{{'widgets.knob.on-value-change-hint' | translate}}" translate>widgets.knob.on-value-change</div>
      <tb-set-value-action-settings class="flex-1"
                                    panelTitle="{{ 'widgets.knob.on-value-change' | translate }}"
                                    [valueType]="valueType.DOUBLE"
                                    [aliasController]="aliasController"
                                    [targetDevice]="targetDevice"
                                    [widgetType]="widgetType"
                                    formControlName="valueChange"></tb-set-value-action-settings>
    </div>
  </div>
  <div class="tb-form-panel">
    <div class="tb-form-panel-title" translate>widget-config.appearance</div>
    <div class="tb-form-row column-xs">
      <div class="fixed-title-width" translate>widgets.rpc.knob-title</div>
      <mat-form-field class="flex" appearance="outline" subscriptSizing="dynamic">
        <input matInput formControlName="title" placeholder="{{ 'widget-config.set' | translate }}">
      </mat-form-field>
    </div>
    <div class="tb-form-row space-between column-xs">
      <div>{{ 'widgets.knob.range' | translate }}</div>
      <div class="flex flex-row items-center justify-start gap-2">
        <div class="tb-small-label" translate>widgets.knob.min</div>
        <mat-form-field appearance="outline" class="number" subscriptSizing="dynamic">
          <input matInput formControlName="minValue" type="number" placeholder="{{ 'widget-config.set' | translate }}">
        </mat-form-field>
        <div class="tb-small-label" translate>widgets.knob.max</div>
        <mat-form-field appearance="outline" class="number" subscriptSizing="dynamic">
          <input matInput formControlName="maxValue" type="number" placeholder="{{ 'widget-config.set' | translate }}">
        </mat-form-field>
      </div>
    </div>
    <div class="tb-form-row column-xs">
      <div class="fixed-title-width">{{ 'widgets.knob.value' | translate }}</div>
      <div class="flex flex-1 flex-row items-center justify-start gap-2">
        <tb-unit-input class="flex" formControlName="valueUnits" supportsUnitConversion></tb-unit-input>
        <mat-form-field appearance="outline" class="number flex" subscriptSizing="dynamic">
          <input matInput formControlName="valueDecimals" type="number" min="0" max="15" step="1" placeholder="{{ 'widget-config.set' | translate }}">
          <div matSuffix class="lt-md:!hidden" translate>widget-config.decimals-suffix</div>
        </mat-form-field>
      </div>
    </div>
    <div class="tb-form-row space-between column-xs">
      <div class="fixed-title-width" translate>widgets.knob.fallback-initial-value</div>
      <mat-form-field class="number" appearance="outline" subscriptSizing="dynamic">
        <input matInput formControlName="initialValue" type="number" placeholder="{{ 'widget-config.set' | translate }}">
      </mat-form-field>
    </div>
  </div>
</ng-container>
