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

export interface InvoicePaymentMethodProps {
  paymentDescription: string;
}

export class InvoicePaymentMethod extends DomainEntity<InvoicePaymentMethodProps> {
  public static create(
    props: InvoicePaymentMethodProps,
    id?: UniqueID
  ): Result<InvoicePaymentMethod, Error> {
    const item = new InvoicePaymentMethod(props, id);

    return Result.ok(item);
  }

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

  getProps(): InvoicePaymentMethodProps {
    return this.props;
  }

  toObjectString() {
    return {
      id: String(this.id),
      payment_description: String(this.paymentDescription),
    };
  }
}
