import { Component, EventEmitter, Input, Output, ChangeDetectionStrategy } from '@angular/core';
import { CommonModule } from '@angular/common';
import { UserService } from '../../../../services/user.service';

@Component({
  selector: 'app-patient-doctors-panel',
  standalone: true,
  imports: [CommonModule],
  templateUrl: './patient-doctors-panel.component.html',
  styleUrls: ['./patient-doctors-panel.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class PatientDoctorsPanelComponent {
  @Input() doctors: any[] = [];
  @Input() loading = false;
  @Input() showDoctorProfileModal = false;
  @Input() selectedDoctorProfile: any = null;

  @Output() viewDoctorProfile = new EventEmitter<string>();
  @Output() removeDoctorFromHistory = new EventEmitter<any>();
  @Output() closeDoctorProfileModal = new EventEmitter<void>();

  constructor(public userService: UserService) {}

  onViewDoctor(doctorId: string): void {
    this.viewDoctorProfile.emit(doctorId);
  }

  onRemoveDoctor(doctor: any, event: Event): void {
    event.stopPropagation();
    this.removeDoctorFromHistory.emit(doctor);
  }

  onCloseModal(): void {
    this.closeDoctorProfileModal.emit();
  }
}

