import { NgIf } from '@angular/common';
import { CUSTOM_ELEMENTS_SCHEMA, Component, Input } from '@angular/core';
import { IonicModule, ModalController } from '@ionic/angular';
import { Swiper } from 'swiper';
import { register } from 'swiper/element/bundle';

register();

@Component({
  selector: 'app-image-modal',
  templateUrl: './image-modal.component.html',
  styleUrls: ['./image-modal.component.scss'],
  standalone: true,
  imports: [IonicModule, NgIf],
  schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class ImageModalComponent {
  @Input() imgUrl: string;
  @Input() slider: Swiper;

  constructor(
    private modalController: ModalController
  ) {
  }

  closeModal() {
    this.modalController.dismiss().then(() => {
      if (this.slider) {
        this.slider.isLocked = false;
      }
    });
  }

}
