@@ -420,54 +420,15 @@ enum InvoiceType {
420
420
}
421
421
422
422
/**
423
- * BillingInvoiceLine represents a line item that is sold to the customer based on a specific (unit) price.
424
- */
425
- @ friendlyName ("InvoiceLine" )
426
- @ discriminated (#{ envelope : "none" , discriminatorPropertyName : "type" })
427
- union InvoiceLine {
428
- usage_based : InvoiceUsageBasedLine ,
429
- flat_fee : InvoiceFlatFeeLine ,
430
- }
431
-
432
- /**
433
- * InvoiceLineReplaceUpdate represents the update model for an invoice line.
434
- */
435
- @ friendlyName ("InvoiceLineReplaceUpdate" )
436
- @ discriminated (#{ envelope : "none" , discriminatorPropertyName : "type" })
437
- union InvoiceLineReplaceUpdate {
438
- usage_based : InvoiceUsageBasedLineReplaceUpdate ,
439
- flat_fee : InvoiceFlatFeeLineReplaceUpdate ,
440
- }
441
-
442
- /**
443
- * InvoiceUpdateUsageBasedLineReplaceUpdate represents the update model for an UBP invoice line.
444
- *
445
- * This type makes ID optional to allow for creating new lines as part of the update.
446
- */
447
- @ friendlyName ("InvoiceUsageBasedLineReplaceUpdate" )
448
- model InvoiceUsageBasedLineReplaceUpdate {
449
- ... TypeSpec .Rest .Resource .ResourceReplaceModel <OmitProperties <
450
- InvoiceUsageBasedLine ,
451
- "id"
452
- >>;
453
-
454
- /**
455
- * The ID of the line.
456
- */
457
- @ visibility (Lifecycle .Update )
458
- id ? : ULID ;
459
- }
460
-
461
- /**
462
- * InvoiceFlatFeeLineReplaceUpdate represents the update model for a flat fee invoice line.
423
+ * InvoiceLineReplaceUpdate represents the update model for an UBP invoice line.
463
424
*
464
425
* This type makes ID optional to allow for creating new lines as part of the update.
465
426
*/
466
- @ friendlyName ("InvoiceFlatFeeLineReplaceUpdate " )
467
- model InvoiceFlatFeeLineReplaceUpdate {
427
+ @ friendlyName ("InvoiceLineReplaceUpdate " )
428
+ model InvoiceLineReplaceUpdate {
468
429
... TypeSpec .Rest .Resource .ResourceReplaceModel <OmitProperties <
469
- InvoiceFlatFeeLine ,
470
- "id"
430
+ InvoiceLine ,
431
+ "id" | "children"
471
432
>>;
472
433
473
434
/**
@@ -478,42 +439,21 @@ model InvoiceFlatFeeLineReplaceUpdate {
478
439
}
479
440
480
441
/**
481
- * InvoiceLineCreate represents the create model for an invoice line.
442
+ * InvoicePendingLineCreate represents the create model for an invoice line that is sold to the customer based on usage .
482
443
*/
483
444
@ friendlyName ("InvoicePendingLineCreate" )
484
- @ discriminated (#{ envelope : "none" , discriminatorPropertyName : "type" })
485
- union InvoicePendingLineCreate {
486
- usage_based : InvoiceUsageBasedPendingLineCreate ,
487
- flat_fee : InvoiceFlatFeePendingLineCreate ,
488
- }
489
-
490
- /**
491
- * InvoiceUsageBasedLineCreateWithCustomer represents the create model for an invoice line that is sold to the customer based on usage.
492
- */
493
- @ friendlyName ("InvoiceUsageBasedPendingLineCreate" )
494
- model InvoiceUsageBasedPendingLineCreate {
495
- // Note: invoice is omitted as the line is assigned a new or existing gathering invoice
496
- ... TypeSpec .Rest .Resource .ResourceCreateModel <OmitProperties <
497
- InvoiceUsageBasedLine ,
498
- "invoice" | "currency"
499
- >>;
500
- }
501
-
502
- /**
503
- * InvoiceFlatFeePendingLineCreate represents the create model for an invoice line that is sold to the customer as a manually added fee.
504
- */
505
- @ friendlyName ("InvoiceFlatFeePendingLineCreate" )
506
- model InvoiceFlatFeePendingLineCreate {
445
+ model InvoicePendingLineCreate {
507
446
// Note: invoice is omitted as the line is assigned a new or existing gathering invoice
508
447
... TypeSpec .Rest .Resource .ResourceCreateModel <OmitProperties <
509
- InvoiceFlatFeeLine ,
510
- "invoice" | "currency"
448
+ InvoiceLine ,
449
+ "invoice" | "currency" | "children"
511
450
>>;
512
451
}
513
452
514
453
/**
515
454
* LineTypes represents the different types of lines that can be used in an invoice.
516
455
*/
456
+ #deprecated "We are moving to a coherent invoice line structure"
517
457
@ friendlyName ("InvoiceLineTypes" )
518
458
enum InvoiceLineTypes {
519
459
flatFee : "flat_fee" ,
@@ -594,7 +534,8 @@ model InvoiceLineBase {
594
534
*
595
535
* A line's type cannot be changed after creation.
596
536
*/
597
- @ visibility (Lifecycle .Read , Lifecycle .Create )
537
+ #deprecated "We are moving to a coherent invoice line structure"
538
+ @ visibility (Lifecycle .Read )
598
539
type : InvoiceLineTypes ;
599
540
600
541
/**
@@ -646,12 +587,6 @@ model InvoiceLineBase {
646
587
@ visibility (Lifecycle .Read , Lifecycle .Create , Lifecycle .Update )
647
588
taxConfig ? : OpenMeter .ProductCatalog .TaxConfig ;
648
589
649
- /**
650
- * The lines detailing the item or service sold.
651
- */
652
- @ visibility (Lifecycle .Read )
653
- children ? : InvoiceLine [];
654
-
655
590
/**
656
591
* Totals for this line.
657
592
*/
@@ -723,19 +658,22 @@ model InvoiceUsageBasedRateCard {
723
658
724
659
/**
725
660
* InvoiceUsageBasedLine represents a line item that is sold to the customer based on usage. */
726
- @ friendlyName ("InvoiceUsageBasedLine " )
727
- model InvoiceUsageBasedLine {
661
+ @ friendlyName ("InvoiceLine " )
662
+ model InvoiceLine {
728
663
... OmitProperties <InvoiceLineBase , "type" >;
729
664
730
665
/**
731
666
* Type of the line.
732
667
*/
668
+ #deprecated "Invoice always has usage-based line children"
669
+ @ visibility (Lifecycle .Read )
733
670
type : InvoiceLineTypes .usageBased ;
734
671
735
672
/**
736
673
* Price of the usage-based item being sold.
737
674
*/
738
675
#deprecated "Use rateCard.price instead"
676
+ @ visibility (Lifecycle .Read , Lifecycle .Create , Lifecycle .Update )
739
677
price ? : OpenMeter .ProductCatalog .RateCardUsageBasedPrice ;
740
678
741
679
/**
@@ -745,6 +683,12 @@ model InvoiceUsageBasedLine {
745
683
@ visibility (Lifecycle .Read , Lifecycle .Create , Lifecycle .Update )
746
684
featureKey ? : Key ;
747
685
686
+ /**
687
+ * The lines detailing the item or service sold.
688
+ */
689
+ @ visibility (Lifecycle .Read )
690
+ children ? : InvoiceDetailedLine [];
691
+
748
692
/**
749
693
* The rate card that is used for this line.
750
694
*
@@ -788,11 +732,11 @@ model InvoiceUsageBasedLine {
788
732
}
789
733
790
734
/**
791
- * InvoiceFlatFeeRateCard represents the rate card (intent) for a flat fee line.
735
+ * InvoiceDetailedLineRateCard represents the rate card (intent) for a flat fee line.
792
736
*/
793
- @ friendlyName ("InvoiceFlatFeeRateCard " )
794
- model InvoiceFlatFeeRateCard {
795
- // TODO: Once the deprecation is done, let's make price required
737
+ @ friendlyName ("InvoiceDetailedLineRateCard " )
738
+ model InvoiceDetailedLineRateCard {
739
+ // TODO[v2] : Once the deprecation is done, let's make price required
796
740
... PickProperties <
797
741
OpenMeter .ProductCatalog .RateCardFlatFee ,
798
742
"taxConfig" | "price"
@@ -814,15 +758,17 @@ model InvoiceFlatFeeRateCard {
814
758
}
815
759
816
760
/**
817
- * InvoiceFlatFeeLine represents a line item that is sold to the customer as a manually added fee.
761
+ * InvoiceDetailedLine represents a line item that is sold to the customer as a manually added fee.
818
762
*/
819
- @ friendlyName ("InvoiceFlatFeeLine " )
820
- model InvoiceFlatFeeLine {
763
+ @ friendlyName ("InvoiceDetailedLine " )
764
+ model InvoiceDetailedLine {
821
765
... OmitProperties <InvoiceLineBase , "type" >;
822
766
823
767
/**
824
768
* Type of the line.
825
769
*/
770
+ #deprecated "Invoice line's children are always detailed lines"
771
+ @ visibility (Lifecycle .Read )
826
772
type : InvoiceLineTypes .flatFee ;
827
773
828
774
/**
@@ -849,23 +795,23 @@ model InvoiceFlatFeeLine {
849
795
/**
850
796
* The rate card that is used for this line.
851
797
*/
852
- // TODO: Once the deprecation is done, let's make rateCard required
798
+ // TODO[v2] : Once the deprecation is done, let's make rateCard required
853
799
@ visibility (Lifecycle .Read , Lifecycle .Create , Lifecycle .Update )
854
- rateCard ? : InvoiceFlatFeeRateCard ;
800
+ rateCard ? : InvoiceDetailedLineRateCard ;
855
801
856
802
/**
857
803
* Category of the flat fee.
858
804
*/
859
- @ visibility (Lifecycle .Read , Lifecycle . Create , Lifecycle . Update )
860
- category ? : InvoiceFlatFeeCategory = InvoiceFlatFeeCategory .regular ;
805
+ @ visibility (Lifecycle .Read )
806
+ category ? : InvoiceDetailedLineCostCategory = InvoiceDetailedLineCostCategory .regular ;
861
807
}
862
808
863
809
/**
864
- * InvoiceFlatFeeCategory determines if the flat fee is a regular fee due to use due to a
810
+ * InvoiceDetailedLineCostCategory determines if the flat fee is a regular fee due to use due to a
865
811
* commitment.
866
812
*/
867
- @ friendlyName ("InvoiceFlatFeeCategory " )
868
- union InvoiceFlatFeeCategory {
813
+ @ friendlyName ("InvoiceDetailedLineCostCategory " )
814
+ union InvoiceDetailedLineCostCategory {
869
815
/**
870
816
* The fee is a regular fee due to usage.
871
817
*/
0 commit comments