import { AggregateRoot, UniqueID } from "@repo/rdx-ddd";
import { Result } from "@repo/rdx-utils";

export interface VerifactuRecordProps {
  id: UniqueID;
  invoiceId: UniqueID;
  estado: string;
  url: string;
  qr1: JSON;
  qr2: Blob;
}

export type IVerifactuRecord = {};

export class VerifactuRecord
  extends AggregateRoot<VerifactuRecordProps>
  implements IVerifactuRecord
{
  protected constructor(props: VerifactuRecordProps, invoiceId: UniqueID) {
    super(props, invoiceId);
  }

  static create(props: VerifactuRecordProps, invoiceId: UniqueID): Result<VerifactuRecord, Error> {
    const verifactuRecord = new VerifactuRecord(props, invoiceId);

    // Reglas de negocio / validaciones

    return Result.ok(verifactuRecord);
  }

  public get invoiceId(): UniqueID {
    return this.props.invoiceId;
  }

  public get estado(): string {
    return this.props.estado;
  }

  public get url(): string {
    return this.props.url;
  }
}
