import { Directive, ElementRef, Input, OnInit } from '@angular/core';
import { SwiperContainer } from 'swiper/element';
import { SwiperOptions } from 'swiper/types';

@Directive({
  selector: '[swiper]',
  standalone: true
})
export class SwiperDirective implements OnInit {
  @Input('config') config?: SwiperOptions;

  constructor(private el: ElementRef<SwiperContainer>) {}

  ngOnInit() {
    Object.assign(this.el.nativeElement, this.config);
    this.el.nativeElement.initialize();
  }
}