import { Injectable } from '@angular/core';
import { Store } from '@ngrx/store';
import { Observable } from 'rxjs';
import { CustomersState } from './customers.state';
import { QueryTokenDTO, CustomerInfoDTO, AddressDTO, ShippingAddressDTO, AssignedPayerDTO } from '@swagger/crm';
import * as CustomersSelectors from './customers.selectors';

@Injectable({ providedIn: 'root' })
export class CustomersStateFacade {
  constructor(private store: Store<any>) {}

  public getGeneralAddress$(customerId: number): Observable<AddressDTO> {
    return this.store.select(CustomersSelectors.selectGeneralAddress, customerId);
  }

  public getPayerAddresses$(customerId: number): Observable<ShippingAddressDTO[]> {
    return;
  }

  public getShippingAddresses$(customerId: number): Observable<AssignedPayerDTO[]> {
    return;
  }

  public setBaseCustomer(customer: CustomerInfoDTO) {
    // import mapper
    // dispatch action to set customer
  }

  public setInvoiceAddresses(customerId: number, address: AddressDTO[]) {}

  public setDeliveryAddresses(customerId: number, address: AddressDTO[]) {}

  private fetchCustomer(id?: number) {
    // fetch single customer
  }

  private fetchCustomers() {
    // fetch multiple customers
  }

  private getQueryToken(): QueryTokenDTO {
    return;
  }
}
