import { CustomerQueueManager } from './customer-queue.manager';

export class CustomerQueuePosItemManager extends CustomerQueueManager {
  get data() {
    const ticket = this.tickets[0];
    const queueItems = this.mergeQueueItems(ticket);
    return {
      id: ticket.id,
      code: ticket.code,
      customer: ticket.customer,
      phone: ticket.phone,
      date: ticket.date,
      summary: this.summaryTicket(ticket),
      items: queueItems.map((item) => {
        return {
          id: item.id,
          item_queue_id: item.item_id,
          title: item.title,
          image_url: item.image_url,
          summary: {
            total_tickets: item.qty,
            total_used: this.totalUsedItems(item.queues),
            total_queue: this.totalQueueItems(item.queues),
            remaining: item.qty - this.totalQueueItems(item.queues),
          },
        };
      }),
    };
  }
}
