| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import { reservation } from "./reservation.js";
- export class reservation_factory {
- #target;
- constructor() {
- this.#target = new reservation();
- }
- phone_number(target) {
- target = target.trim();
- if (target.length === 0) {
- target = null;
- }
- this.#target.phone_number = target;
- return this;
- }
- email(target) {
- target = target.trim();
- if (target.length === 0) {
- target = null;
- }
- this.#target.email = target;
- return this;
- }
- product(target) {
- this.#target.product_barcode = target.barcode;
- return this;
- }
- result() {
- if (this.#target.ready) {
- return this.#target;
- }
- throw new Error("Target reservation is not ready yet.");
- }
- }
|