<!--

    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 class="tb-round-switch" fxLayout="column" [ngStyle]="{'pointerEvents': ctx.isEdit ? 'none' : 'all'}">
  <div #switchTitleContainer fxFlex="20" class="title-container" fxLayout="row" fxLayoutAlign="center center" [fxShow]="showTitle">
    <span #switchTitle class="switch-title">{{title}}</span>
  </div>
  <div #switchContainer fxFlex="{{showTitle ? 80 : 100}}" [ngStyle]="{paddingTop: showTitle ? '5px': '10px'}" id="switch-container" fxLayout="column" fxLayoutAlign="center center">
    <div #switch class="switch">
      <input #onoff type="checkbox" id="{{checkboxId}}" name="onoff" />
      <div class="back">
        <label class="but" for="{{checkboxId}}">
          <span class="on">I</span>
          <span class="off">0</span>
        </label>
      </div>
    </div>
  </div>
  <div #switchErrorContainer class="error-container" [ngStyle]="{'background': error?.length ? 'rgba(255,255,255,0.25)' : 'none'}"
       fxLayout="row" fxLayoutAlign="center center">
    <span #switchError class="switch-error">{{ error }}</span>
  </div>
  <div #textMeasure id="text-measure"></div>
</div>
