<div class="d-flex justify-content-center">
  <div class="col-8">
    @if (metadataProperty()) {
      <div>
        <h2 data-cy="metadataPropertyDetailsHeading">
          <span jhiTranslate="resilientApp.metadataProperty.detail.title">Metadata Property</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>{{ metadataProperty()!.id }}</span>
          </dd>
          <dt><span jhiTranslate="resilientApp.metadataProperty.code">Code</span></dt>
          <dd>
            <span>{{ metadataProperty()!.code }}</span>
          </dd>
          <dt><span jhiTranslate="resilientApp.metadataProperty.name">Name</span></dt>
          <dd>
            <span>{{ metadataProperty()!.name }}</span>
          </dd>
          <dt><span jhiTranslate="resilientApp.metadataProperty.description">Description</span></dt>
          <dd>
            <span>{{ metadataProperty()!.description }}</span>
          </dd>
          <dt><span jhiTranslate="resilientApp.metadataProperty.mandatory">Mandatory</span></dt>
          <dd>
            <span>{{ metadataProperty()!.mandatory }}</span>
          </dd>
          <dt><span jhiTranslate="resilientApp.metadataProperty.metadataType">Metadata Type</span></dt>
          <dd>
            <span [jhiTranslate]="'resilientApp.MetadataType.' + (metadataProperty()!.metadataType ?? 'null')">{{
              { null: '', STRING: 'STRING', BOOLEAN: 'BOOLEAN', INTEGER: 'INTEGER', DECIMAL: 'DECIMAL', DATE: 'DATE' }[
                metadataProperty()!.metadataType ?? 'null'
              ]
            }}</span>
          </dd>
          <dt>
            <span
              [ngbTooltip]="'resilientApp.metadataProperty.help.pattern' | translate"
              jhiTranslate="resilientApp.metadataProperty.pattern"
              >Pattern</span
            >
          </dt>
          <dd>
            <span>{{ metadataProperty()!.pattern }}</span>
          </dd>
          <dt>
            <span
              [ngbTooltip]="'resilientApp.metadataProperty.help.version' | translate"
              jhiTranslate="resilientApp.metadataProperty.version"
              >Version</span
            >
          </dt>
          <dd>
            <span>{{ metadataProperty()!.version }}</span>
          </dd>
          <dt><span jhiTranslate="resilientApp.metadataProperty.organizationType">Organization Type</span></dt>
          <dd>
            @for (organizationType of metadataProperty()!.organizationTypes; track $index; let last = $last) {
              <span>
                <a [routerLink]="['/organization-type', organizationType.id, 'view']">{{ organizationType?.name }}</a
                >{{ last ? '' : ', ' }}
              </span>
            }
          </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]="['/metadata-property', metadataProperty()!.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>
