<!--

    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.

-->
<div class="tb-scada-symbol-editor-shape" [class.!hidden]="editorMode !== 'svg'" #scadaSymbolShape></div>
<div class="tb-scada-symbol-editor-tooltips" [class.!hidden]="editorMode !== 'svg'" #tooltipsContainer>
  <tb-anchor #tooltipsContainerComponent></tb-anchor>
</div>
<div class="tb-scada-symbol-editor-svg-xml" [class.!hidden]="editorMode !== 'xml'">
  <tb-svg-xml [formControl]="svgContentFormControl"
              fillHeight
              noLabel>
  </tb-svg-xml>
</div>
<div class="tb-scada-symbol-editor-buttons">
  <div class="tb-scada-symbol-editor-view-buttons">
    <div class="tb-scada-symbol-editor-zoom-buttons tb-primary-fill" [class.!hidden]="editorMode !== 'svg'">
      <button mat-icon-button
              [disabled]="zoomInDisabled"
              (click)="zoomIn()"
              matTooltip="{{ 'scada.zoom-in' | translate }}"
              matTooltipPosition="above">
        <mat-icon>add</mat-icon>
      </button>
      <button mat-icon-button
              [disabled]="zoomOutDisabled"
              (click)="zoomOut()"
              matTooltip="{{ 'scada.zoom-out' | translate }}"
              matTooltipPosition="above">
        <mat-icon>remove</mat-icon>
      </button>
    </div>
    @if (displayShowHidden) {
      <div [class.!hidden]="editorMode !== 'svg'" class="tb-primary-fill">
        <button mat-icon-button
                (click)="toggleShowHidden()"
                matTooltip="{{ (showHiddenElements ? 'scada.hide-hidden-elements' : 'scada.show-hidden-elements') | translate }}"
                matTooltipPosition="above">
          <mat-icon>{{ showHiddenElements ? 'visibility_off' : 'visibility' }}</mat-icon>
        </button>
      </div>
    }
  </div>
  <div class="tb-scada-symbol-editor-right-buttons">
    <div class="tb-primary-fill">
      <button mat-icon-button
              (click)="updateScadaSymbol.emit()"
              matTooltip="{{ 'scada.update-symbol' | translate }}"
              matTooltipPosition="above">
        <mat-icon>file_upload</mat-icon>
      </button>
    </div>
    <div class="tb-primary-fill">
      <button mat-icon-button
              (click)="downloadScadaSymbol.emit()"
              matTooltip="{{ 'scada.download-symbol' | translate }}"
              matTooltipPosition="above">
        <mat-icon>download</mat-icon>
      </button>
    </div>
    <tb-toggle-select appearance="fill"
                      [disabled]="!readonly && !svgContentFormControl.valid"
                      fillHeight
                      extraPadding
                      primaryBackground
                      [(ngModel)]="editorMode">
      <tb-toggle-option value="svg">{{ 'scada.mode-svg' | translate }}</tb-toggle-option>
      <tb-toggle-option value="xml">{{ 'scada.mode-xml' | translate }}</tb-toggle-option>
    </tb-toggle-select>
  </div>
</div>
