import { ISequelizeAdapter, SequelizeRepository } from "@/contexts/common/infrastructure/sequelize";
import { Transaction } from "sequelize";
import { InvoiceCustomer } from "../domain";
import { IInvoiceParticipantMapper } from "./mappers";

export class InvoiceParticipantRepository extends SequelizeRepository<InvoiceCustomer> {
  protected mapper: IInvoiceParticipantMapper;

  public constructor(props: {
    mapper: IInvoiceParticipantMapper;
    adapter: ISequelizeAdapter;
    transaction: Transaction;
  }) {
    const { adapter, mapper, transaction } = props;
    super({ adapter, transaction });
    this.mapper = mapper;
  }

  /*public async getParticipantById(
    id: UniqueID,
  ): Promise<InvoiceParticipant | null> {
    const rawParticipant: any = await this._getById(
      "InvoiceParticipant_Model",
      id,
      {
        include: [{ all: true }],
        raw: true,
      },
    );

    if (!rawParticipant === true) {
      return null;
    }

    return this.mapper.mapToDomain(rawParticipant);
  }

  public async getContactById(id: UniqueID): Promise<any | null> {
    const rawContact: any = await this._getById("Customer", id, {
      include: [{ all: true }],
      raw: true,
    });

    if (!rawContact === true) {
      return null;
    }

    return this.mapper.mapToDomain(rawContact);
  }

  public async exists(id: UniqueID): Promise<boolean> {
    return this._exists("Customer", "id", id.toString());
  }*/
}
