<!--

    Copyright © 2016-2023 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 style="background: #fff;" [ngClass]="{'fill-height': fillHeight}"
     tb-fullscreen
     [fullscreen]="fullscreen" (fullscreenChanged)="onFullscreen()" fxLayout="column">
  <div fxLayout="row" fxLayoutAlign="start center" class="tb-json-object-toolbar">
    <label class="tb-title no-padding"
           [ngClass]="{'tb-required': jsonRequired,
                       'tb-readonly': readonly,
                       'tb-error': !objectValid}">{{ label }}</label>
    <span fxFlex></span>
    <button type="button"
            mat-button *ngIf="!readonly && !disabled" class="tidy" (click)="beautifyJSON()">
      {{'js-func.tidy' | translate }}
    </button>
    <button type="button"
            mat-button *ngIf="!readonly && !disabled" class="tidy" (click)="minifyJSON()">
      {{'js-func.mini' | translate }}
    </button>
    <button mat-icon-button class="tb-mat-32" (click)="fullscreen = !fullscreen"
            matTooltip="{{(fullscreen ? 'fullscreen.exit' : 'fullscreen.expand') | translate}}"
            matTooltipPosition="above">
      <mat-icon class="material-icons">{{ fullscreen ? 'fullscreen_exit' : 'fullscreen' }}</mat-icon>
    </button>
  </div>
  <div id="tb-json-panel" tb-toast toastTarget="{{toastTargetId}}"
       class="tb-json-object-panel" fxLayout="column">
    <div #jsonEditor id="tb-json-input" [ngStyle]="editorStyle" [ngClass]="{'fill-height': fillHeight}"></div>
  </div>
</div>
