<div class="d-flex justify-content-center">
  <div class="col-8">
    @if (variable()) {
      <div>
        <h2 data-cy="variableDetailsHeading"><span jhiTranslate="resilientApp.variable.detail.title">Variable</span></h2>

        <hr />

        <jhi-alert-error></jhi-alert-error>

        <jhi-alert></jhi-alert>

        <dl class="row-md jh-entity-details">
          <dt><span jhiTranslate="global.field.id">Código</span></dt>
          <dd>
            <span>{{ variable()!.id }}</span>
          </dd>
          <dt><span [ngbTooltip]="'resilientApp.variable.help.code' | translate" jhiTranslate="resilientApp.variable.code">Code</span></dt>
          <dd>
            <span>{{ variable()!.code }}</span>
          </dd>
          <dt>
            <span [ngbTooltip]="'resilientApp.variable.help.variableIndex' | translate" jhiTranslate="resilientApp.variable.variableIndex"
              >Variable Index</span
            >
          </dt>
          <dd>
            <span>{{ variable()!.variableIndex }}</span>
          </dd>
          <dt><span [ngbTooltip]="'resilientApp.variable.help.name' | translate" jhiTranslate="resilientApp.variable.name">Name</span></dt>
          <dd>
            <span>{{ variable()!.name }}</span>
          </dd>
          <dt>
            <span [ngbTooltip]="'resilientApp.variable.help.description' | translate" jhiTranslate="resilientApp.variable.description"
              >Description</span
            >
          </dt>
          <dd>
            <span>{{ variable()!.description }}</span>
          </dd>
          <dt>
            <span [ngbTooltip]="'resilientApp.variable.help.input' | translate" jhiTranslate="resilientApp.variable.input">Input</span>
          </dt>
          <dd>
            <span>{{ variable()!.input }}</span>
          </dd>
          <dt>
            <span [ngbTooltip]="'resilientApp.variable.help.inputMode' | translate" jhiTranslate="resilientApp.variable.inputMode"
              >Input Mode</span
            >
          </dt>
          <dd>
            <span [jhiTranslate]="'resilientApp.InputMode.' + (variable()!.inputMode ?? 'null')">{{
              { null: '', DATAFILE: 'DATAFILE', MANUAL: 'MANUAL', INTEGRATION: 'INTEGRATION', ANY: 'ANY' }[variable()!.inputMode ?? 'null']
            }}</span>
          </dd>
          <dt>
            <span [ngbTooltip]="'resilientApp.variable.help.output' | translate" jhiTranslate="resilientApp.variable.output">Output</span>
          </dt>
          <dd>
            <span>{{ variable()!.output }}</span>
          </dd>
          <dt>
            <span [ngbTooltip]="'resilientApp.variable.help.outputFormula' | translate" jhiTranslate="resilientApp.variable.outputFormula"
              >Output Formula</span
            >
          </dt>
          <dd>
            <span>{{ variable()!.outputFormula }}</span>
          </dd>
          <dt>
            <span [ngbTooltip]="'resilientApp.variable.help.version' | translate" jhiTranslate="resilientApp.variable.version"
              >Version</span
            >
          </dt>
          <dd>
            <span>{{ variable()!.version }}</span>
          </dd>
          <dt><span jhiTranslate="resilientApp.variable.baseUnit">Base Unit</span></dt>
          <dd>
            @if (variable()!.baseUnit) {
              <div>
                <a [routerLink]="['/unit', variable()!.baseUnit?.id, 'view']">{{ variable()!.baseUnit?.name }}</a>
              </div>
            }
          </dd>
          <dt><span jhiTranslate="resilientApp.variable.variableScope">Variable Scope</span></dt>
          <dd>
            @if (variable()!.variableScope) {
              <div>
                <a [routerLink]="['/variable-scope', variable()!.variableScope?.id, 'view']">{{ variable()!.variableScope?.name }}</a>
              </div>
            }
          </dd>
          <dt><span jhiTranslate="resilientApp.variable.variableCategory">Variable Category</span></dt>
          <dd>
            @if (variable()!.variableCategory) {
              <div>
                <a [routerLink]="['/variable-category', variable()!.variableCategory?.id, 'view']">{{
                  variable()!.variableCategory?.name
                }}</a>
              </div>
            }
          </dd>
        </dl>

        <button type="submit" (click)="previousState()" class="btn btn-info" data-cy="entityDetailsBackButton">
          <fa-icon icon="arrow-left"></fa-icon>&nbsp;<span jhiTranslate="entity.action.back">Voltar</span>
        </button>

        <button type="button" [routerLink]="['/variable', variable()!.id, 'edit']" class="btn btn-primary">
          <fa-icon icon="pencil-alt"></fa-icon>&nbsp;<span jhiTranslate="entity.action.edit">Editar</span>
        </button>
      </div>
    }
  </div>
</div>
