import { Component, ChangeDetectionStrategy } from '@angular/core';
import { ApplicationService } from '@core/application';
import { CustomerDTO } from '@swagger/crm';
import { UiModalRef } from '@ui/modal';

@Component({
  selector: 'page-cant-select-guest-modal',
  templateUrl: 'cant-select-guest-modal.component.html',
  styleUrls: ['cant-select-guest-modal.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CantSelectGuestModalComponent {
  constructor(public ref: UiModalRef<any, CustomerDTO>, public readonly applicationService: ApplicationService) {}

  createCustomerDataQuery(customer: CustomerDTO): { [key: string]: string } {
    const query: { [key: string]: string } = {
      gender: String(customer.gender),
      title: customer?.title,
      firstName: customer?.firstName,
      lastName: customer?.lastName,
      email: customer?.communicationDetails?.email,
      phone: customer?.communicationDetails?.phone,
      mobile: customer?.communicationDetails?.mobile,
      street: customer?.address?.street,
      streetNumber: customer?.address?.streetNumber,
      zipCode: customer?.address?.zipCode,
      city: customer?.address?.city,
      country: customer?.address?.country,
      info: customer?.address?.info,
      name: customer?.organisation?.name,
      department: customer?.organisation?.department,
      vatId: customer?.organisation?.vatId,
      dateOfBirth: customer?.dateOfBirth,
    };

    return query;
  }
}
