import { Component, inject, input } from '@angular/core';
import { RouterModule } from '@angular/router';

import SharedModule from 'app/shared/shared.module';
import { DurationPipe, FormatMediumDatetimePipe, FormatMediumDatePipe } from 'app/shared/date';
import { DataUtils } from 'app/core/util/data-util.service';
import { IOrganization } from '../organization.model';
import { OrganizationNature } from 'app/entities/enumerations/organization-nature.model';

@Component({
  standalone: true,
  selector: 'jhi-organization-detail',
  templateUrl: './organization-detail.component.html',
  imports: [SharedModule, RouterModule, DurationPipe, FormatMediumDatetimePipe, FormatMediumDatePipe],
})
export class OrganizationDetailComponent {
  organization = input<IOrganization | null>(null);

  // Needed to make the enum OrganizationNature accessible to the template
  organizationNature = OrganizationNature;
  
  protected dataUtils = inject(DataUtils);

  byteSize(base64String: string): string {
    return this.dataUtils.byteSize(base64String);
  }

  openFile(base64String: string, contentType: string | null | undefined): void {
    this.dataUtils.openFile(base64String, contentType);
  }

  previousState(): void {
    window.history.back();
  }
}
