import { ChangeDetectorRef, Component, NgZone, OnInit } from '@angular/core';
import { IClientModel } from '@fleio-api/client-user/model/client.model';
import { DetailsComponentBase } from '@objects-view/details-component-base';
import { ConfigService } from '@shared/config/config.service';
import { ActivatedRoute } from '@angular/router';
import {
  IUserNotificationSettingsResponseModel
} from '@fleio-api/notifications/model/user-notification-settings-response.model';

@Component({
  selector: 'app-enduser-client-detail-overview',
  templateUrl: './enduser-client-detail-overview.component.html',
  styleUrls: ['./enduser-client-detail-overview.component.scss']
})
export class EnduserClientDetailOverviewComponent extends DetailsComponentBase<IClientModel> implements OnInit {
  notificationsSettings: IUserNotificationSettingsResponseModel;
  getAllTicketNotificationsTooltip = $localize`Receives all ticket notifications\nfor related client`;

  constructor(
    private activatedRoute: ActivatedRoute,
    public config: ConfigService,
    ngZone: NgZone,
    changeDetectorRef: ChangeDetectorRef,
  ) {
    super(ngZone, changeDetectorRef, config);
  }

  ngOnInit(refreshTimerInterval?: number) {
    super.ngOnInit(refreshTimerInterval);
    this.notificationsSettings = this.activatedRoute.snapshot.data?.notificationsSettings;
  }

  protected refreshData() {
    super.refreshData();
    this.notificationsSettings = this.activatedRoute.snapshot.data?.notificationsSettings;
  }
}
