import { Percentage, PercentageProps } from "@repo/rdx-ddd";
import { Result } from "@repo/rdx-utils";

type ItemDiscountProps = Pick<PercentageProps, "value">;

export class ItemDiscount extends Percentage {
  static DEFAULT_SCALE = 2;

  static create({ value }: ItemDiscountProps): Result<Percentage> {
    return Percentage.create({
      value,
      scale: ItemDiscount.DEFAULT_SCALE,
    });
  }

  static zero() {
    return ItemDiscount.create({ value: 0 }).data;
  }
}
