]> Git — Sourcephile - tmp/julm/literate-invoice.git/blob - tests/Tests/Invoice.hs
maint/correctness(Invoice): use sum type for ActionId
[tmp/julm/literate-invoice.git] / tests / Tests / Invoice.hs
1 {-# LANGUAGE DeriveAnyClass #-}
2 {-# LANGUAGE OverloadedLists #-}
3 {-# LANGUAGE OverloadedStrings #-}
4
5 module Tests.Invoice where
6
7 import Data.List qualified as List
8 import Data.Text.Lazy qualified as Text.Lazy
9 import Data.Time.Clock qualified as Time
10 import Data.Time.LocalTime qualified as Time
11 import Test.Syd (Spec, describe, goldenByteStringBuilderFile, it)
12 import Tests.Organization qualified as Orga
13 import Tests.Utils.Tests (goldenPath)
14 import Text.Blaze.Renderer.Text qualified as Blaze.Text
15 import Text.Blaze.Renderer.Utf8 qualified as Blaze
16 import Prelude ((*))
17
18 import Literate.Accounting (Amount, Unit (UnitName))
19 import Literate.Database
20 import Literate.Document qualified as Doc
21 import Literate.Document.HTML qualified as HTML
22 import Literate.Invoice
23 import Literate.Invoice.HTML (invoiceIdInline)
24 import Literate.Invoice.HTML qualified as HTML
25 import Literate.Prelude
26
27 spec :: HasCallStack => Spec
28 spec =
29 -- aroundAll readDicts do
30 describe "Invoice" do
31 forM_ invoices \invId -> do
32 let
33 inv = invId & get @(Invoice ActionId Orga.EntityId InvoiceId)
34 idS =
35 inv
36 & invoiceIdInline
37 & HTML.toHtml
38 & Blaze.Text.renderMarkup
39 & Text.Lazy.unpack
40 outPath <- goldenPath idS "html"
41 it idS do
42 goldenByteStringBuilderFile outPath do
43 inv & HTML.htmlIO <&> Blaze.renderMarkupBuilder
44
45 works_NGIpkgs :: [Work ActionId]
46 works_NGIpkgs =
47 [ Work
48 { workDate = "2025-11-06"
49 , workDuration = 0.5
50 , workAction = Action_Organization
51 , workScope = ["NGIpkgs"]
52 , workReferences = ["https://meet.google.com/hii-druc-tjp"]
53 , workDescription = "first meeting"
54 }
55 , Work
56 { workDate = "2025-11-06"
57 , workDuration = 4
58 , workAction = Action_Development
59 , workScope = ["NGIpkgs", "Bonfire"]
60 , workReferences = ["https://github.com/ju1m/bonfire-app/commits/nix"]
61 , workDescription = "focus on the hardest part first"
62 }
63 , Work
64 { workDate = "2025-11-07"
65 , workDuration = 8
66 , workAction = Action_Development
67 , workScope = ["NGIpkgs", "Bonfire"]
68 , workReferences = ["https://github.com/ju1m/bonfire-app/commits/nix"]
69 , workDescription = "continuing to package Bonfire deps"
70 }
71 , Work
72 { workDate = "2025-11-08"
73 , workDuration = 0.1
74 , workAction = Action_Development
75 , workScope = ["Nixpkgs", "opencv"]
76 , workReferences = ["https://github.com/NixOS/nixpkgs/pull/459592"]
77 , workDescription = "fix opencv in nixpkgs"
78 }
79 , Work
80 { workDate = "2025-11-09"
81 , workDuration = 8
82 , workAction = Action_Development
83 , workScope = ["NGIpkgs", "Bonfire"]
84 , workReferences = ["https://github.com/ju1m/bonfire-app/commits/nix"]
85 , workDescription = "continue to fix deps"
86 }
87 , Work
88 { workDate = "2025-11-09"
89 , workDuration = 4
90 , workAction = Action_Development
91 , workScope = ["NGIpkgs", "Bonfire"]
92 , workReferences = ["https://github.com/ju1m/bonfire-app/commits/nix"]
93 , workDescription = "continue to fix deps"
94 }
95 , Work
96 { workDate = "2025-11-11"
97 , workDuration = 6
98 , workAction = Action_Development
99 , workScope = ["NGIpkgs", "Bonfire"]
100 , workReferences = ["https://github.com/ju1m/bonfire-app/commits/nix"]
101 , workDescription = "continue to fix deps"
102 }
103 , Work
104 { workDate = "2025-11-12"
105 , workDuration = 4
106 , workAction = Action_Development
107 , workScope = ["NGIpkgs", "Bonfire"]
108 , workReferences = ["https://github.com/ju1m/bonfire-app/commits/nix"]
109 , workDescription = "continue to fix deps"
110 }
111 , Work
112 { workDate = "2025-11-14"
113 , workDuration = 5
114 , workAction = Action_Development
115 , workScope = ["NGIpkgs", "Bonfire"]
116 , workReferences = ["https://github.com/ngi-nix/ngipkgs/pull/1812"]
117 , workDescription = "continue to fix deps and move into ngipkgs"
118 }
119 , Work
120 { workDate = "2025-11-14"
121 , workDuration = 1
122 , workAction = Action_Organization
123 , workScope = ["NGIpkgs"]
124 , workReferences = ["https://www.notion.so/nixos-foundation/Nix-NGI-weekly-review-34-2ab59d49e1be80939503c655b009e934"]
125 , workDescription = "weekly meeting"
126 }
127 , Work
128 { workDate = "2025-11-15"
129 , workDuration = 6
130 , workAction = Action_Development
131 , workScope = ["NGIpkgs", "Bonfire"]
132 , workReferences = []
133 , workDescription = "finish to build Bonfire and start to fix runtime bugs"
134 }
135 , Work
136 { workDate = "2025-11-16"
137 , workDuration = 4
138 , workAction = Action_Development
139 , workScope = ["NGIpkgs", "Bonfire"]
140 , workReferences = ["https://github.com/ngi-nix/ngipkgs/pull/1812#issuecomment-3537609170"]
141 , workDescription = "workaround and contribute upstream"
142 }
143 , Work
144 { workDate = "2025-11-17"
145 , workDuration = 8
146 , workAction = Action_Development
147 , workScope = ["NGIpkgs", "Bonfire"]
148 , workReferences = []
149 , workDescription = "add updateScript and fix opencv"
150 }
151 , Work
152 { workDate = "2025-11-19"
153 , workDuration = 8
154 , workAction = Action_Development
155 , workScope = ["NGIpkgs", "Bonfire"]
156 , workReferences = ["https://github.com/ngi-nix/ngipkgs/pull/1812#issuecomment-3554376221"]
157 , workDescription = "continue to fix startup crashes"
158 }
159 , Work
160 { workDate = "2025-11-21"
161 , workDuration = 4
162 , workAction = Action_Development
163 , workScope = ["NGIpkgs", "Bonfire"]
164 , workReferences = []
165 , workDescription = "begin to package yarn assets. Upstream likes convoluted code and fake libraries."
166 }
167 , Work
168 { workDate = "2025-11-21"
169 , workDuration = 1
170 , workAction = Action_Organization
171 , workScope = ["NGIpkgs"]
172 , workReferences = []
173 , workDescription = "weekly meeting"
174 }
175 , Work
176 { workDate = "2025-11-21"
177 , workDuration = 4
178 , workAction = Action_Development
179 , workScope = ["NGIpkgs", "Bonfire"]
180 , workReferences = []
181 , workDescription = "continue to package assets"
182 }
183 , Work
184 { workDate = "2025-11-23"
185 , workDuration = 4
186 , workAction = Action_Development
187 , workScope = ["NGIpkgs", "Bonfire"]
188 , workReferences = []
189 , workDescription = "continue to package assets and try to get Bonfire to work"
190 }
191 , Work
192 { workDate = "2025-11-24"
193 , workDuration = 10
194 , workAction = Action_Development
195 , workScope = ["NGIpkgs", "Bonfire"]
196 , workReferences = ["https://github.com/surface-ui/surface/issues/762#issuecomment-3577030748"]
197 , workDescription = "continue to solve problems with Bonfire packaging"
198 }
199 , Work
200 { workDate = "2025-11-27"
201 , workDuration = 8
202 , workAction = Action_Development
203 , workScope = ["NGIpkgs", "Bonfire"]
204 , workReferences = ["https://github.com/ngi-nix/ngipkgs/pull/1812#issuecomment-3584319056"]
205 , workDescription = "successfully auto-update and build Bonfire"
206 }
207 , Work
208 { workDate = "2025-11-28"
209 , workDuration = 1
210 , workAction = Action_Organization
211 , workScope = ["NGIpkgs"]
212 , workReferences = ["https://www.notion.so/nixos-foundation/Nix-NGI-weekly-review-36-2b959d49e1be80fa823cd4d83581fda5#2b959d49e1be80fc85eed38c9a9dca86"]
213 , workDescription = "weekly meeting"
214 }
215 , Work
216 { workDate = "2025-11-29"
217 , workDuration = 5
218 , workAction = Action_Development
219 , workScope = ["NGIpkgs", "Bonfire"]
220 , workReferences = []
221 , workDescription = "begin the service module"
222 }
223 , Work
224 { workDate = "2025-12-02"
225 , workDuration = 4
226 , workAction = Action_Development
227 , workScope = ["NGIpkgs", "Bonfire"]
228 , workReferences = []
229 , workDescription = "continue the service module"
230 }
231 , Work
232 { workDate = "2025-12-03"
233 , workDuration = 8
234 , workAction = Action_Development
235 , workScope = ["NGIpkgs", "Bonfire"]
236 , workReferences = []
237 , workDescription = "first working service module"
238 }
239 , Work
240 { workDate = "2025-12-04"
241 , workDuration = 5
242 , workAction = Action_Development
243 , workScope = ["NGIpkgs", "Bonfire"]
244 , workReferences = ["https://github.com/ngi-nix/ngipkgs/pull/1871"]
245 , workDescription = "improve service module"
246 }
247 , Work
248 { workDate = "2025-12-05"
249 , workDuration = 1
250 , workAction = Action_Organization
251 , workScope = ["NGIpkgs"]
252 , workReferences = ["https://www.notion.so/nixos-foundation/Nix-NGI-weekly-review-36-2b959d49e1be80fa823cd4d83581fda5"]
253 , workDescription = "weekly meeting"
254 }
255 , Work
256 { workDate = "2025-12-05"
257 , workDuration = 0.5
258 , workAction = Action_Documentation
259 , workScope = ["NGIpkgs", "Manuals"]
260 , workReferences = ["https://github.com/ngi-nix/ngipkgs/pull/1954"]
261 , workDescription = "meeting"
262 }
263 , Work
264 { workDate = "2025-12-06"
265 , workDuration = 2
266 , workAction = Action_Documentation
267 , workScope = ["NGIpkgs", "Manuals"]
268 , workReferences = []
269 , workDescription = "prepare wednesday meeting"
270 }
271 , Work
272 { workDate = "2025-12-07"
273 , workDuration = 4
274 , workAction = Action_Documentation
275 , workScope = ["NGIpkgs", "Manuals"]
276 , workReferences = []
277 , workDescription = "prepare demo for wednesday meeting"
278 }
279 , Work
280 { workDate = "2025-12-08"
281 , workDuration = 4
282 , workAction = Action_Documentation
283 , workScope = ["NGIpkgs", "Manuals"]
284 , workReferences = ["https://github.com/ngi-nix/ngipkgs/pull/1891"]
285 , workDescription = "prepare demo for wednesday meeting"
286 }
287 , Work
288 { workDate = "2025-12-09"
289 , workDuration = 4
290 , workAction = Action_Documentation
291 , workScope = ["NGIpkgs", "Manuals"]
292 , workReferences = ["https://github.com/ngi-nix/ngipkgs/pull/1891"]
293 , workDescription = "continue to document"
294 }
295 , Work
296 { workDate = "2025-12-10"
297 , workDuration = 2
298 , workAction = Action_Review
299 , workScope = ["NGIpkgs"]
300 , workReferences = ["https://www.notion.so/nixos-foundation/Nix-NGI-best-practices-for-NixOS-modules-implementation-2c559d49e1be80a8a499f21abb203d6f"]
301 , workDescription = "visio on “best practices”"
302 }
303 , Work
304 { workDate = "2025-12-12"
305 , workDuration = 1
306 , workAction = Action_Organization
307 , workScope = ["NGIpkgs"]
308 , workReferences = []
309 , workDescription = "weekly visio meeting"
310 }
311 , Work
312 { workDate = "2025-12-11"
313 , workDuration = 8
314 , workAction = Action_Documentation
315 , workScope = ["NGIpkgs", "Manuals"]
316 , workReferences = []
317 , workDescription = "continue to document"
318 }
319 , Work
320 { workDate = "2025-12-12"
321 , workDuration = 4
322 , workAction = Action_Documentation
323 , workScope = ["NGIpkgs", "Manuals"]
324 , workReferences = []
325 , workDescription = "continue to document"
326 }
327 , Work
328 { workDate = "2025-12-13"
329 , workDuration = 2
330 , workAction = Action_Documentation
331 , workScope = ["NGIpkgs", "Manuals"]
332 , workReferences = []
333 , workDescription =
334 [ "setup sphinx like "
335 , Doc.InlineLink
336 { Doc.inlineLinkTarget = "https://nix.dev"
337 , Doc.inlineLinkText = "nix.dev"
338 }
339 , " for the manuals"
340 ]
341 }
342 , Work
343 { workDate = "2025-12-13"
344 , workDuration = 5
345 , workAction = Action_Development
346 , workScope = ["NGIpkgs", "Bonfire"]
347 , workReferences = ["https://github.com/bonfire-networks/bonfire-app/issues/1670#issuecomment-3650762914"]
348 , workDescription = "update to latest; overcoming new bugs introduced by upstream"
349 }
350 , Work
351 { workDate = "2025-12-15"
352 , workDuration = 4
353 , workAction = Action_Development
354 , workScope = ["NGIpkgs", "Bonfire"]
355 , workReferences = []
356 , workDescription = "improving the update script and still overcoming upstream bugs"
357 }
358 , Work
359 { workDate = "2025-12-16"
360 , workDuration = 3
361 , workAction = Action_Development
362 , workScope = ["NGIpkgs", "Bonfire"]
363 , workReferences = []
364 , workDescription = "overcoming bugs, again"
365 }
366 , Work
367 { workDate = "2025-12-16"
368 , workDuration = 2
369 , workAction = Action_Review
370 , workScope = ["NGIpkgs"]
371 , workReferences = []
372 , workDescription = "visio to review PRs"
373 }
374 , Work
375 { workDate = "2025-12-16"
376 , workDuration = 2
377 , workAction = Action_Review
378 , workScope = ["NGIpkgs"]
379 , workReferences = []
380 , workDescription = "visio to review PRs"
381 }
382 , Work
383 { workDate = "2025-12-17"
384 , workDuration = 1.5
385 , workAction = Action_Review
386 , workScope = ["NGIpkgs"]
387 , workReferences = []
388 , workDescription = "visio to review PRs"
389 }
390 , Work
391 { workDate = "2025-12-18"
392 , workDuration = 1
393 , workAction = Action_Review
394 , workScope = ["NGIpkgs", "dnsvizor"]
395 , workReferences = []
396 , workDescription = "review linj’s PR"
397 }
398 , Work
399 { workDate = "2025-12-19"
400 , workDuration = 1.5
401 , workAction = Action_Organization
402 , workScope = ["NGIpkgs"]
403 , workReferences = []
404 , workDescription = "weekly meeting"
405 }
406 , Work
407 { workDate = "2025-12-21"
408 , workDuration = 4
409 , workAction = Action_Development
410 , workScope = ["NGIpkgs", "Bonfire"]
411 , workReferences = []
412 , workDescription =
413 [ "fix bug using "
414 , "__structuredAttrs" & Doc.InlineCode
415 ]
416 }
417 , Work
418 { workDate = "2025-12-23"
419 , workDuration = 4
420 , workAction = Action_Documentation
421 , workScope = ["NGIpkgs", "Manuals"]
422 , workReferences = []
423 , workDescription = "improve building the manuals"
424 }
425 , Work
426 { workDate = "2025-12-23"
427 , workDuration = 2
428 , workAction = Action_Development
429 , workScope = ["NGIpkgs", "Bonfire"]
430 , workReferences = []
431 , workDescription = "address reviewers’ concerns"
432 }
433 , Work
434 { workDate = "2025-12-24"
435 , workDuration = 4
436 , workAction = Action_Development
437 , workScope = ["NGIpkgs", "Bonfire"]
438 , workReferences = []
439 , workDescription = "update Bonfire and report issues upstream"
440 }
441 , Work
442 { workDate = "2025-12-24"
443 , workDuration = 4
444 , workAction = Action_Documentation
445 , workScope = ["NGIpkgs", "Manuals"]
446 , workReferences = []
447 , workDescription = "document"
448 }
449 , Work
450 { workDate = "2025-12-24"
451 , workDuration = 2
452 , workAction = Action_Development
453 , workScope = ["NGIpkgs", "Bonfire"]
454 , workReferences = []
455 , workDescription = "update Bonfire to fix bugs"
456 }
457 , Work
458 { workDate = "2025-12-25"
459 , workDuration = 2
460 , workAction = Action_Documentation
461 , workScope = ["NGIpkgs", "Manuals"]
462 , workReferences = []
463 , workDescription = "document"
464 }
465 , Work
466 { workDate = "2025-12-25"
467 , workDuration = 6
468 , workAction = Action_Development
469 , workScope = ["NGIpkgs", "Bonfire"]
470 , workReferences = ["https://github.com/bonfire-networks/bonfire-app/issues/1698#issuecomment-3692147409"]
471 , workDescription = "update and fix bugs"
472 }
473 , Work
474 { workDate = "2025-12-26"
475 , workDuration = 1
476 , workAction = Action_Development
477 , workScope = ["NGIpkgs", "Bonfire"]
478 , workReferences = []
479 , workDescription = "update to fix bugs"
480 }
481 , Work
482 { workDate = "2025-12-28"
483 , workDuration = 6
484 , workAction = Action_Documentation
485 , workScope = ["NGIpkgs", "Manuals"]
486 , workReferences = []
487 , workDescription = "document"
488 }
489 , Work
490 { workDate = "2025-12-29"
491 , workDuration = 2
492 , workAction = Action_Development
493 , workScope = ["NGIpkgs", "Bonfire"]
494 , workReferences = []
495 , workDescription = "add more tests"
496 }
497 , Work
498 { workDate = "2025-12-29"
499 , workDuration = 0.5
500 , workAction = Action_Review
501 , workScope = ["NGIpkgs", "Funkwhale"] -- goes into NGI Review
502 , workReferences = ["https://github.com/ngi-nix/ngipkgs/pull/1707#discussion_r2651644145"]
503 , workDescription = ""
504 }
505 , Work
506 { workDate = "2025-12-30"
507 , workDuration = 4
508 , workAction = Action_Development
509 , workScope = ["NGIpkgs", "BEAM"]
510 , workReferences = []
511 , workDescription = ["improve ", Doc.InlineCode "buildMix", " & ", Doc.InlineCode "mixRelease", " for packaging Elixir software"]
512 }
513 , Work
514 { workDate = "2026-01-01"
515 , workDuration = 4
516 , workAction = Action_Development
517 , workScope = ["NGIpkgs", "Bonfire"]
518 , workReferences = []
519 , workDescription = "support other flavours"
520 }
521 , Work
522 { workDate = "2026-01-03"
523 , workDuration = 4
524 , workAction = Action_Development
525 , workScope = ["NGIpkgs", "Bonfire"]
526 , workReferences = []
527 , workDescription = "support other flavours, and make update more resilient"
528 }
529 , Work
530 { workDate = "2026-01-04"
531 , workDuration = 2
532 , workAction = Action_Development
533 , workScope = ["NGIpkgs", "Bonfire"]
534 , workReferences = []
535 , workDescription = "provide upstream with reproducers"
536 }
537 , Work
538 { workDate = "2026-01-05"
539 , workDuration = 2
540 , workAction = Action_Development
541 , workScope = ["NGIpkgs", "Bonfire"]
542 , workReferences = []
543 , workDescription = "update to latest version"
544 }
545 , Work
546 { workDate = "2026-01-07"
547 , workDuration = 5
548 , workAction = Action_Development
549 , workScope = ["NGIpkgs", "Bonfire"]
550 , workReferences = []
551 , workDescription = "fix updating"
552 }
553 , Work
554 { workDate = "2026-01-07"
555 , workDuration = 1
556 , workAction = Action_Documentation
557 , workScope = ["NGIpkgs", "Manuals"] -- goes into NGI Core
558 , workReferences = ["https://github.com/ngi-nix/ngipkgs/pull/1891"]
559 , workDescription = "address reviewer’s comment"
560 }
561 , Work
562 { workDate = "2026-01-09"
563 , workDuration = 2
564 , workAction = Action_Documentation
565 , workScope = ["NGIpkgs", "Manuals"] -- goes into NGI Core
566 , workReferences = []
567 , workDescription = "address reviewer’s comments"
568 }
569 , Work
570 { workDate = "2026-01-09"
571 , workDuration = 2
572 , workAction = Action_Development
573 , workScope = ["NGIpkgs", "Bonfire"]
574 , workReferences = ["https://github.com/bonfire-networks/bonfire-app/issues/1730"]
575 , workDescription = "answer upstream’s questions"
576 }
577 , Work
578 { workDate = "2026-01-11"
579 , workDuration = 5
580 , workAction = Action_Development
581 , workScope = ["NGIpkgs", "dnsvizor"]
582 , workReferences = []
583 , workDescription = ["replace ", Doc.InlineCode "hillingar", " to package MirageOS unikernels"]
584 }
585 , Work
586 { workDate = "2026-01-09"
587 , workDuration = 2
588 , workAction = Action_Organization
589 , workScope = ["NGIpkgs"]
590 , workReferences = []
591 , workDescription = "weekly meeting"
592 }
593 , Work
594 { workDate = "2026-01-12"
595 , workDuration = 5
596 , workAction = Action_Development
597 , workScope = ["NGIpkgs", "dnsvizor"]
598 , workReferences = ["https://github.com/ju1m/ngipkgs/commits/dnsvizor/"]
599 , workDescription = ["remove the need for ", Doc.InlineCode "--allow-import-from-derivation"]
600 }
601 , Work
602 { workDate = "2026-01-12"
603 , workDuration = 6
604 , workAction = Action_Documentation
605 , workScope = ["NGIpkgs", "Manuals"] -- goes into NGI Core
606 , workReferences = []
607 , workDescription = "render options"
608 }
609 , Work
610 { workDate = "2026-01-13"
611 , workDuration = 1
612 , workAction = Action_Documentation
613 , workScope = ["NGIpkgs", "Manuals"] -- goes into NGI Core
614 , workReferences = []
615 , workDescription = "update"
616 }
617 , Work
618 { workDate = "2026-01-16"
619 , workDuration = 2
620 , workAction = Action_Organization
621 , workScope = ["NGIpkgs"]
622 , workReferences = []
623 , workDescription = "weekly meeting"
624 }
625 , Work
626 { workDate = "2026-01-19"
627 , workDuration = 2
628 , workAction = Action_Documentation
629 , workScope = ["NGIpkgs", "Manuals"] -- goes into NGI Core
630 , workReferences = []
631 , workDescription = "split into several PDF"
632 }
633 , Work
634 { workDate = "2026-01-22"
635 , workDuration = 4
636 , workAction = Action_Development
637 , workScope = ["NGIpkgs", "Manuals"] -- goes into NGI Core
638 , workReferences = ["https://github.com/ngi-nix/ngipkgs/pull/2010"]
639 , workDescription = "address reviewers’ concerns"
640 }
641 , Work
642 { workDate = "2026-01-23"
643 , workDuration = 1.5
644 , workAction = Action_Organization
645 , workScope = ["NGIpkgs"]
646 , workReferences = []
647 , workDescription = "weekly meeting"
648 }
649 , Work
650 { workDate = "2026-01-25"
651 , workDuration = 4
652 , workAction = Action_Development
653 , workScope = ["NGIpkgs", "Seppo"]
654 , workReferences = []
655 , workDescription = "begin packaging"
656 }
657 , Work
658 { workDate = "2026-01-26"
659 , workDuration = 5
660 , workAction = Action_Development
661 , workScope = ["NGIpkgs", "Seppo"]
662 , workReferences = []
663 , workDescription = "continue packaging"
664 }
665 , Work
666 { workDate = "2026-01-27"
667 , workDuration = 5
668 , workAction = Action_Development
669 , workScope = ["NGIpkgs", "Seppo"]
670 , workReferences = []
671 , workDescription = "continue packaging"
672 }
673 ]
674
675 data InvoiceId
676 = Invoice_0
677 | Invoice_org3sale1
678 | Invoice_org3sale2
679 | Invoice_org3sale3
680 deriving (Eq, Ord, Show, Generic, Enum, NFData)
681
682 invoiceRate_NGIpkgs =
683 [ Action_Organization := 31.25
684 , Action_Development := 31.25
685 , Action_Documentation := 31.25
686 , Action_Review := 31.25
687 ]
688
689 data ActionId
690 = Action_Organization
691 | Action_Development
692 | Action_Documentation
693 | Action_Review
694 deriving (Eq, Ord, Show, Generic, Enum, NFData)
695
696 instance Doc.ToInline ActionId where
697 toInline = \case
698 Action_Development -> "development"
699 Action_Documentation -> "documentation"
700 Action_Organization -> "organization"
701 Action_Review -> "review"
702
703 instance Get (Invoice ActionId Orga.EntityId InvoiceId) InvoiceId where
704 get invoiceId = case invoiceId of
705 Invoice_0 ->
706 Invoice
707 { invoiceId
708 , invoiceType = InvoiceTypeSale
709 , invoiceOrders = []
710 , invoiceEmittedOn
711 , invoicePaymentDueBefore = invoiceEmittedOn & Time.addLocalTime (31 * Time.nominalDay)
712 , invoiceIssuer = Orga.EntityJulmInfo
713 , invoiceRecipient = Orga.EntityJulmInfo
714 , invoiceRates = [Action_Development := 0]
715 , invoiceMentions =
716 [ InvoiceMentionTVANonApplicable
717 , InvoiceMentionIndemnitéForfaitaire
718 , InvoiceMentionIndemnitéTaux (12.15 :: Amount 100 (UnitName "%"))
719 ]
720 , invoiceWorks =
721 [ Work
722 { workDate = "2000-01-01"
723 , workDuration = 1
724 , workAction = Action_Development
725 , workScope = []
726 , workReferences = []
727 , workDescription = ""
728 }
729 ]
730 }
731 where
732 invoiceEmittedOn = "2026-01-22"
733 Invoice_org3sale1 ->
734 Invoice
735 { invoiceId
736 , invoiceType = InvoiceTypeSale
737 , invoiceOrders = ["Contract n°2025-24"]
738 , invoiceEmittedOn
739 , invoicePaymentDueBefore = invoiceEmittedOn & Time.addLocalTime (31 * Time.nominalDay)
740 , invoiceIssuer = Orga.EntityJulmInfo
741 , invoiceRecipient = Orga.EntityNixOSFoundationNGITeam
742 , invoiceRates = invoiceRate_NGIpkgs
743 , invoiceMentions =
744 [ InvoiceMentionTVANonApplicable
745 , InvoiceMentionIndemnitéForfaitaire
746 , InvoiceMentionIndemnitéTaux (12.15 :: Amount 100 (UnitName "%"))
747 ]
748 , invoiceWorks =
749 works_NGIpkgs
750 & List.filter \work ->
751 and $
752 list
753 [ work & workDate & (>= "2025-11-06")
754 , work & workDate & (<= "2025-12-22")
755 , work & workScope & (/= ["NGIpkgs", "Manuals"])
756 ]
757 }
758 where
759 invoiceEmittedOn = "2026-01-22"
760 Invoice_org3sale2 ->
761 Invoice
762 { invoiceId
763 , invoiceType = InvoiceTypeSale
764 , invoiceOrders = ["contract n°2026-03"]
765 , invoiceEmittedOn
766 , invoicePaymentDueBefore = invoiceEmittedOn & Time.addLocalTime (31 * Time.nominalDay)
767 , invoiceIssuer = Orga.EntityJulmInfo
768 , invoiceRecipient = Orga.EntityNixOSFoundationNGITeam
769 , invoiceRates = invoiceRate_NGIpkgs
770 , invoiceMentions =
771 [ InvoiceMentionTVANonApplicable
772 , InvoiceMentionIndemnitéForfaitaire
773 , InvoiceMentionIndemnitéTaux (12.15 :: Amount 100 (UnitName "%"))
774 ]
775 , invoiceWorks =
776 works_NGIpkgs
777 & List.filter \work ->
778 and $
779 [ work & workDate & (>= "2025-12-23")
780 , work & workDate & (<= "2026-12-31")
781 , work & workScope & (/= ["NGIpkgs", "Manuals"])
782 , work & workScope & (/= ["NGIpkgs", "Funkwhale"])
783 , not $
784 and $
785 [ work & workDate & (>= "2026-01-09")
786 , work & workDate & (<= "2026-01-28")
787 , work & workAction & (== Action_Organization)
788 , work & workScope & (== ["NGIpkgs"])
789 ]
790 & list
791 ]
792 & list
793 }
794 where
795 invoiceEmittedOn = "2026-01-27"
796 Invoice_org3sale3 ->
797 Invoice
798 { invoiceId
799 , invoiceType = InvoiceTypeSale
800 , invoiceOrders = ["contract n°2026-FixMe"]
801 , invoiceEmittedOn
802 , invoicePaymentDueBefore = invoiceEmittedOn & Time.addLocalTime (31 * Time.nominalDay)
803 , invoiceIssuer = Orga.EntityJulmInfo
804 , invoiceRecipient = Orga.EntityNixOSFoundationNGITeam
805 , invoiceRates = invoiceRate_NGIpkgs
806 , invoiceMentions =
807 [ InvoiceMentionTVANonApplicable
808 , InvoiceMentionIndemnitéForfaitaire
809 , InvoiceMentionIndemnitéTaux (12.15 :: Amount 100 (UnitName "%"))
810 ]
811 , invoiceWorks =
812 works_NGIpkgs
813 & List.filter \work ->
814 or $
815 [ and $
816 [ work & workDate & (>= "2026-01-21")
817 , work & workDate & (<= "2026-12-31")
818 , work & workScope & (== ["NGIpkgs", "Manuals"])
819 ]
820 & list
821 , and $
822 [ work & workDate & (>= "2025-12-29")
823 , work & workDate & (<= "2026-12-31")
824 , work & workScope & (== ["NGIpkgs", "Funkwhale"])
825 ]
826 & list
827 , and $
828 [ work & workDate & (>= "2026-01-09")
829 , work & workDate & (<= "2026-01-28")
830 , work & workAction & (== Action_Organization)
831 , work & workScope & (== ["NGIpkgs"])
832 ]
833 & list
834 ]
835 & list
836 }
837 where
838 invoiceEmittedOn = "2026-01-28"
839
840 invoices :: [InvoiceId]
841 invoices = enumAll