28 lines
708 B
Plaintext
28 lines
708 B
Plaintext
// product.rhai
|
|
|
|
// Create a product component
|
|
let component = new_product_component()
|
|
.name("Sub-component A")
|
|
.description("A vital part of the main product.")
|
|
.quantity(10);
|
|
|
|
print("New Product Component:");
|
|
print(component);
|
|
|
|
// Create a product and add the component
|
|
let new_product = new_product()
|
|
.name("Super Product")
|
|
.description("A product that does amazing things.")
|
|
.price(99.99)
|
|
.type("Product")
|
|
.category("Gadgets")
|
|
.status("Available")
|
|
.max_amount(100)
|
|
.purchase_till(1735689600) // Future timestamp
|
|
.active_till(1735689600) // Future timestamp
|
|
.add_component(component)
|
|
.save_product();
|
|
|
|
print("\nNew Product:");
|
|
print(new_product);
|