package pt.ist.fenixframework.example.petstore.domain; valueType java.math.BigDecimal as BigDecimal { externalizeWith { String toString(); } } class PetStore; // Accounts class Account { String userId; String password; } relation PetStoreHasAccounts { PetStore playsRole petStore; Account playsRole account { multiplicity *; //indexed by userId; } } // Customers class Customer { String email; String firstname; String lastname; String language; String telephone; } relation CustomerHasAccount { Customer playsRole customer; Account playsRole account; } relation PetStoreHasCustomers { PetStore playsRole petStore; Customer playsRole customer { multiplicity *; } } class Address { String city; String country; String state; String street1; String street2; String zipcode; } relation CustomerHasAddress { Customer playsRole customer; Address playsRole address; } class CreditCard { String number; String type; String expiryDate; } relation CustomerHasCreditCard { Customer playsRole customer; CreditCard playsRole creditCard; } // Products class NamedEntity { String name; String description; } class Product extends NamedEntity { String productId; } relation PetStoreHasProducts { PetStore playsRole petStore; Product playsRole product { multiplicity *; //indexed by productId; } } // Categories class Category extends NamedEntity { String categoryId; } relation CategoryHasProducts { Category playsRole category; Product playsRole product { multiplicity *; //indexed by productId; } } relation PetStoreHasCategories { PetStore playsRole petStore; Category playsRole category { multiplicity *; //indexed by categoryId; } } // Items class Item { String itemId; BigDecimal listPrice; BigDecimal unitCost; String description; String imagePath; } relation ProductHasItems { Product playsRole product; Item playsRole item { multiplicity *; } } relation PetStoreHasItems { PetStore playsRole petStore; Item playsRole item { multiplicity *; //indexed by itemId; } } // Orders class Order { String status; LocalDate orderDate; } relation OrderHasAddress { Order playsRole order { multiplicity *; } Address playsRole address; } relation OrderHasCreditCard { Order playsRole order { multiplicity *; } CreditCard playsRole creditCard; } relation OrderHasCustomer { Order playsRole order { multiplicity *; } Customer playsRole customer; } class OrderItem { int quantity; BigDecimal unitPrice; } relation OrderItemHasItem { Item playsRole item; OrderItem playsRole orderItem { multiplicity *; } } relation OrderHasItems { Order playsRole order; OrderItem playsRole orderItem { multiplicity *; } }