1- const MODEL = `namespace hello@1.0.0
2- import org.accordproject.money@0.3.0.{MonetaryAmount} from https://models.accordproject.org/money@0.3.0.cto
3-
4- concept Address {
5- o String line1
6- o String city
7- o String state
8- o String country
9- }
1+ const MODEL = `namespace org.accordproject.service@1.0.0
102
11- concept OrderLine {
12- o String sku
3+ concept ServiceItem {
4+ o String description
5+ o Double rate
136 o Integer quantity
14- o Double price
157}
168
17- concept Order {
18- o DateTime createdAt
19- o OrderLine[] orderLines
9+ concept Compensation {
10+ o ServiceItem[] services
11+ o Integer paymentTerms
2012}
2113
2214@template
23- concept TemplateData {
24- o String name
25- o Address address
26- o Integer age optional
27- o MonetaryAmount salary
28- o String[] favoriteColors
29- o Order order
15+ concept ServiceAgreement {
16+ o String clientName
17+ o String clientAddress
18+ o String providerName
19+ o String providerAddress
20+ o DateTime effectiveDate
21+ o Compensation compensation
3022}` ;
3123
32- const TEMPLATE = `> A general sample that uses a range of features
33- ### Welcome {{name}}!
24+ const TEMPLATE = `# SERVICE AGREEMENT
3425
35- 
26+ This Service Agreement is made and entered into as of
27+ {{effectiveDate as "D MMMM YYYY"}}
28+ by and between {{clientName}}, located at {{clientAddress}} (Client),
29+ and {{providerName}}, located at {{providerAddress}} (Provider).
3630
37- {{#clause address}}
38- #### Address
39- > {{line1}},
40- {{city}}, {{state}},
41- {{country}}
42- {{/clause}}
31+ ---
4332
44- - You are *{{age}}* years old
45- - Your monthly salary is {{salary as "0,0.00 CCC"}}
46- - Your favorite colours are {{#join favoriteColors}}
33+ ## 1. Services
4734
48- {{#clause order}}
49- ## Orders
50- Your last order was placed {{createdAt as "D MMMM YYYY"}} ({{% return now.diff(order.createdAt, 'day')%}} days ago).
35+ {{#clause compensation}}
36+ ### Services Provided
5137
52- {{#ulist orderLines }}
53- - {{quantity}}x _{{sku}}_ @ £{{price as "0,0 .00"}}
38+ {{#ulist services }}
39+ - {{description}} at {{rate as "0.00"}} per unit × {{quantity }}
5440{{/ulist}}
55- Order total: {{% return '£' + order.orderLines.map(ol => ol.price * ol.quantity).reduce((sum, cur) => sum + cur).toFixed(2);%}}
41+
42+ ### Payment Terms
43+ Payment is due within {{paymentTerms}} days of invoice.
5644{{/clause}}
5745
58- Thank you.
46+ ---
47+
48+ ## 2. Total Compensation
49+
50+ **Total Service Value:** {{%
51+ return '$' + compensation.services
52+ .map(s => s.rate * s.quantity)
53+ .reduce((sum, cur) => sum + cur, 0)
54+ .toFixed(2);
55+ %}}
56+
57+ ---
58+
59+ ## 3. Execution
60+
61+ IN WITNESS WHEREOF, the parties hereto have executed this Agreement.
62+
63+ ### Client:
64+ 
65+
66+ {{clientName}}
67+
68+ ### Provider:
69+
70+ 
71+
72+ {{providerName}}
73+
5974` ;
6075
6176const DATA = {
62- "$class" : "hello@1.0.0.TemplateData" ,
63- "name" : "John Doe" ,
64- "address" : {
65- "line1" : "1 Main Street" ,
66- "city" : "Boson" ,
67- "state" : "MA" ,
68- "country" : "USA"
69- } ,
70- "age" : 42 ,
71- "salary" : {
72- "$class" : "org.accordproject.money@0.3.0.MonetaryAmount" ,
73- "doubleValue" : 1500 ,
74- "currencyCode" : "EUR"
75- } ,
76- "favoriteColors" : [ 'red' , 'green' , 'blue' ] ,
77- "order" : {
78- "createdAt" : "2023-05-01" ,
79- "$class" : "hello@1.0.0.Order" ,
80- "orderLines" :
81- [
82- {
83- "$class" : "hello@1.0.0.OrderLine" ,
84- "sku" : "ABC-123" ,
85- "quantity" : 3 ,
86- "price" : 29.99
87- } ,
88- {
89- "$class" : "hello@1.0.0.OrderLine" ,
90- "sku" : "DEF-456" ,
91- "quantity" : 5 ,
92- "price" : 19.99
93- }
77+ "$class" : "org.accordproject.service@1.0.0.ServiceAgreement" ,
78+ "effectiveDate" : "2026-02-01T00:00:00Z" ,
79+ "clientName" : "Acme Corp" ,
80+ "clientAddress" : "123 Business Road, London, UK" ,
81+ "providerName" : "DevConsult Ltd" ,
82+ "providerAddress" : "456 Tech Street, Berlin, Germany" ,
83+ "compensation" : {
84+ "$class" : "org.accordproject.service@1.0.0.Compensation" ,
85+ "paymentTerms" : 30 ,
86+ "services" : [
87+ {
88+ "$class" : "org.accordproject.service@1.0.0.ServiceItem" ,
89+ "description" : "Backend Development" ,
90+ "rate" : 80 ,
91+ "quantity" : 40
92+ } ,
93+ {
94+ "$class" : "org.accordproject.service@1.0.0.ServiceItem" ,
95+ "description" : "Code Review" ,
96+ "rate" : 60 ,
97+ "quantity" : 10
98+ }
9499 ]
95- }
100+ }
96101} ;
97102
98- const NAME = 'Customer Order' ;
99- export { NAME , MODEL , DATA , TEMPLATE } ;
103+ const NAME = 'Service Agreement' ;
104+
105+ export { NAME , MODEL , DATA , TEMPLATE } ;
0 commit comments