File size: 29,571 Bytes
63a69a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
// Code generated by ent, DO NOT EDIT.

package chargeusagebased

import (
	"fmt"
	"time"

	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
	"github.com/openmeterio/openmeter/openmeter/billing"
	"github.com/openmeterio/openmeter/openmeter/billing/charges/meta"
	"github.com/openmeterio/openmeter/openmeter/billing/charges/usagebased"
	"github.com/openmeterio/openmeter/openmeter/productcatalog"
)

const (
	// Label holds the string label denoting the chargeusagebased type in the database.
	Label = "charge_usage_based"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldCustomerID holds the string denoting the customer_id field in the database.
	FieldCustomerID = "customer_id"
	// FieldServicePeriodFrom holds the string denoting the service_period_from field in the database.
	FieldServicePeriodFrom = "service_period_from"
	// FieldServicePeriodTo holds the string denoting the service_period_to field in the database.
	FieldServicePeriodTo = "service_period_to"
	// FieldBillingPeriodFrom holds the string denoting the billing_period_from field in the database.
	FieldBillingPeriodFrom = "billing_period_from"
	// FieldBillingPeriodTo holds the string denoting the billing_period_to field in the database.
	FieldBillingPeriodTo = "billing_period_to"
	// FieldFullServicePeriodFrom holds the string denoting the full_service_period_from field in the database.
	FieldFullServicePeriodFrom = "full_service_period_from"
	// FieldFullServicePeriodTo holds the string denoting the full_service_period_to field in the database.
	FieldFullServicePeriodTo = "full_service_period_to"
	// FieldStatus holds the string denoting the status field in the database.
	FieldStatus = "status"
	// FieldUniqueReferenceID holds the string denoting the unique_reference_id field in the database.
	FieldUniqueReferenceID = "unique_reference_id"
	// FieldCurrency holds the string denoting the currency field in the database.
	FieldCurrency = "currency"
	// FieldManagedBy holds the string denoting the managed_by field in the database.
	FieldManagedBy = "managed_by"
	// FieldSubscriptionID holds the string denoting the subscription_id field in the database.
	FieldSubscriptionID = "subscription_id"
	// FieldSubscriptionPhaseID holds the string denoting the subscription_phase_id field in the database.
	FieldSubscriptionPhaseID = "subscription_phase_id"
	// FieldSubscriptionItemID holds the string denoting the subscription_item_id field in the database.
	FieldSubscriptionItemID = "subscription_item_id"
	// FieldAdvanceAfter holds the string denoting the advance_after field in the database.
	FieldAdvanceAfter = "advance_after"
	// FieldTaxCodeID holds the string denoting the tax_code_id field in the database.
	FieldTaxCodeID = "tax_code_id"
	// FieldTaxBehavior holds the string denoting the tax_behavior field in the database.
	FieldTaxBehavior = "tax_behavior"
	// FieldAnnotations holds the string denoting the annotations field in the database.
	FieldAnnotations = "annotations"
	// FieldNamespace holds the string denoting the namespace field in the database.
	FieldNamespace = "namespace"
	// FieldMetadata holds the string denoting the metadata field in the database.
	FieldMetadata = "metadata"
	// FieldCreatedAt holds the string denoting the created_at field in the database.
	FieldCreatedAt = "created_at"
	// FieldUpdatedAt holds the string denoting the updated_at field in the database.
	FieldUpdatedAt = "updated_at"
	// FieldDeletedAt holds the string denoting the deleted_at field in the database.
	FieldDeletedAt = "deleted_at"
	// FieldName holds the string denoting the name field in the database.
	FieldName = "name"
	// FieldDescription holds the string denoting the description field in the database.
	FieldDescription = "description"
	// FieldInvoiceAt holds the string denoting the invoice_at field in the database.
	FieldInvoiceAt = "invoice_at"
	// FieldSettlementMode holds the string denoting the settlement_mode field in the database.
	FieldSettlementMode = "settlement_mode"
	// FieldIntentDeletedAt holds the string denoting the intent_deleted_at field in the database.
	FieldIntentDeletedAt = "intent_deleted_at"
	// FieldDiscounts holds the string denoting the discounts field in the database.
	FieldDiscounts = "discounts"
	// FieldFeatureKey holds the string denoting the feature_key field in the database.
	FieldFeatureKey = "feature_key"
	// FieldFeatureID holds the string denoting the feature_id field in the database.
	FieldFeatureID = "feature_id"
	// FieldRatingEngine holds the string denoting the rating_engine field in the database.
	FieldRatingEngine = "rating_engine"
	// FieldPrice holds the string denoting the price field in the database.
	FieldPrice = "price"
	// FieldUnitConfig holds the string denoting the unit_config field in the database.
	FieldUnitConfig = "unit_config"
	// FieldCurrentRealizationRunID holds the string denoting the current_realization_run_id field in the database.
	FieldCurrentRealizationRunID = "current_realization_run_id"
	// FieldStatusDetailed holds the string denoting the status_detailed field in the database.
	FieldStatusDetailed = "status_detailed"
	// EdgeRuns holds the string denoting the runs edge name in mutations.
	EdgeRuns = "runs"
	// EdgeDetailedLines holds the string denoting the detailed_lines edge name in mutations.
	EdgeDetailedLines = "detailed_lines"
	// EdgeCurrentRun holds the string denoting the current_run edge name in mutations.
	EdgeCurrentRun = "current_run"
	// EdgeCharge holds the string denoting the charge edge name in mutations.
	EdgeCharge = "charge"
	// EdgeIntentOverride holds the string denoting the intent_override edge name in mutations.
	EdgeIntentOverride = "intent_override"
	// EdgeSubscription holds the string denoting the subscription edge name in mutations.
	EdgeSubscription = "subscription"
	// EdgeSubscriptionPhase holds the string denoting the subscription_phase edge name in mutations.
	EdgeSubscriptionPhase = "subscription_phase"
	// EdgeSubscriptionItem holds the string denoting the subscription_item edge name in mutations.
	EdgeSubscriptionItem = "subscription_item"
	// EdgeCustomer holds the string denoting the customer edge name in mutations.
	EdgeCustomer = "customer"
	// EdgeFeature holds the string denoting the feature edge name in mutations.
	EdgeFeature = "feature"
	// EdgeTaxCode holds the string denoting the tax_code edge name in mutations.
	EdgeTaxCode = "tax_code"
	// Table holds the table name of the chargeusagebased in the database.
	Table = "charge_usage_based"
	// RunsTable is the table that holds the runs relation/edge.
	RunsTable = "charge_usage_based_runs"
	// RunsInverseTable is the table name for the ChargeUsageBasedRuns entity.
	// It exists in this package in order to avoid circular dependency with the "chargeusagebasedruns" package.
	RunsInverseTable = "charge_usage_based_runs"
	// RunsColumn is the table column denoting the runs relation/edge.
	RunsColumn = "charge_id"
	// DetailedLinesTable is the table that holds the detailed_lines relation/edge.
	DetailedLinesTable = "charge_usage_based_run_detailed_line"
	// DetailedLinesInverseTable is the table name for the ChargeUsageBasedRunDetailedLine entity.
	// It exists in this package in order to avoid circular dependency with the "chargeusagebasedrundetailedline" package.
	DetailedLinesInverseTable = "charge_usage_based_run_detailed_line"
	// DetailedLinesColumn is the table column denoting the detailed_lines relation/edge.
	DetailedLinesColumn = "charge_id"
	// CurrentRunTable is the table that holds the current_run relation/edge.
	CurrentRunTable = "charge_usage_based"
	// CurrentRunInverseTable is the table name for the ChargeUsageBasedRuns entity.
	// It exists in this package in order to avoid circular dependency with the "chargeusagebasedruns" package.
	CurrentRunInverseTable = "charge_usage_based_runs"
	// CurrentRunColumn is the table column denoting the current_run relation/edge.
	CurrentRunColumn = "current_realization_run_id"
	// ChargeTable is the table that holds the charge relation/edge.
	ChargeTable = "charges"
	// ChargeInverseTable is the table name for the Charge entity.
	// It exists in this package in order to avoid circular dependency with the "charge" package.
	ChargeInverseTable = "charges"
	// ChargeColumn is the table column denoting the charge relation/edge.
	ChargeColumn = "charge_usage_based_id"
	// IntentOverrideTable is the table that holds the intent_override relation/edge.
	IntentOverrideTable = "charge_usage_based_overrides"
	// IntentOverrideInverseTable is the table name for the ChargeUsageBasedOverride entity.
	// It exists in this package in order to avoid circular dependency with the "chargeusagebasedoverride" package.
	IntentOverrideInverseTable = "charge_usage_based_overrides"
	// IntentOverrideColumn is the table column denoting the intent_override relation/edge.
	IntentOverrideColumn = "charge_id"
	// SubscriptionTable is the table that holds the subscription relation/edge.
	SubscriptionTable = "charge_usage_based"
	// SubscriptionInverseTable is the table name for the Subscription entity.
	// It exists in this package in order to avoid circular dependency with the "subscription" package.
	SubscriptionInverseTable = "subscriptions"
	// SubscriptionColumn is the table column denoting the subscription relation/edge.
	SubscriptionColumn = "subscription_id"
	// SubscriptionPhaseTable is the table that holds the subscription_phase relation/edge.
	SubscriptionPhaseTable = "charge_usage_based"
	// SubscriptionPhaseInverseTable is the table name for the SubscriptionPhase entity.
	// It exists in this package in order to avoid circular dependency with the "subscriptionphase" package.
	SubscriptionPhaseInverseTable = "subscription_phases"
	// SubscriptionPhaseColumn is the table column denoting the subscription_phase relation/edge.
	SubscriptionPhaseColumn = "subscription_phase_id"
	// SubscriptionItemTable is the table that holds the subscription_item relation/edge.
	SubscriptionItemTable = "charge_usage_based"
	// SubscriptionItemInverseTable is the table name for the SubscriptionItem entity.
	// It exists in this package in order to avoid circular dependency with the "subscriptionitem" package.
	SubscriptionItemInverseTable = "subscription_items"
	// SubscriptionItemColumn is the table column denoting the subscription_item relation/edge.
	SubscriptionItemColumn = "subscription_item_id"
	// CustomerTable is the table that holds the customer relation/edge.
	CustomerTable = "charge_usage_based"
	// CustomerInverseTable is the table name for the Customer entity.
	// It exists in this package in order to avoid circular dependency with the "customer" package.
	CustomerInverseTable = "customers"
	// CustomerColumn is the table column denoting the customer relation/edge.
	CustomerColumn = "customer_id"
	// FeatureTable is the table that holds the feature relation/edge.
	FeatureTable = "charge_usage_based"
	// FeatureInverseTable is the table name for the Feature entity.
	// It exists in this package in order to avoid circular dependency with the "dbfeature" package.
	FeatureInverseTable = "features"
	// FeatureColumn is the table column denoting the feature relation/edge.
	FeatureColumn = "feature_id"
	// TaxCodeTable is the table that holds the tax_code relation/edge.
	TaxCodeTable = "charge_usage_based"
	// TaxCodeInverseTable is the table name for the TaxCode entity.
	// It exists in this package in order to avoid circular dependency with the "dbtaxcode" package.
	TaxCodeInverseTable = "tax_codes"
	// TaxCodeColumn is the table column denoting the tax_code relation/edge.
	TaxCodeColumn = "tax_code_id"
)

// Columns holds all SQL columns for chargeusagebased fields.
var Columns = []string{
	FieldID,
	FieldCustomerID,
	FieldServicePeriodFrom,
	FieldServicePeriodTo,
	FieldBillingPeriodFrom,
	FieldBillingPeriodTo,
	FieldFullServicePeriodFrom,
	FieldFullServicePeriodTo,
	FieldStatus,
	FieldUniqueReferenceID,
	FieldCurrency,
	FieldManagedBy,
	FieldSubscriptionID,
	FieldSubscriptionPhaseID,
	FieldSubscriptionItemID,
	FieldAdvanceAfter,
	FieldTaxCodeID,
	FieldTaxBehavior,
	FieldAnnotations,
	FieldNamespace,
	FieldMetadata,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldDeletedAt,
	FieldName,
	FieldDescription,
	FieldInvoiceAt,
	FieldSettlementMode,
	FieldIntentDeletedAt,
	FieldDiscounts,
	FieldFeatureKey,
	FieldFeatureID,
	FieldRatingEngine,
	FieldPrice,
	FieldUnitConfig,
	FieldCurrentRealizationRunID,
	FieldStatusDetailed,
}

// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
	for i := range Columns {
		if column == Columns[i] {
			return true
		}
	}
	return false
}

var (
	// CustomerIDValidator is a validator for the "customer_id" field. It is called by the builders before save.
	CustomerIDValidator func(string) error
	// CurrencyValidator is a validator for the "currency" field. It is called by the builders before save.
	CurrencyValidator func(string) error
	// TaxCodeIDValidator is a validator for the "tax_code_id" field. It is called by the builders before save.
	TaxCodeIDValidator func(string) error
	// NamespaceValidator is a validator for the "namespace" field. It is called by the builders before save.
	NamespaceValidator func(string) error
	// DefaultCreatedAt holds the default value on creation for the "created_at" field.
	DefaultCreatedAt func() time.Time
	// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
	DefaultUpdatedAt func() time.Time
	// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
	UpdateDefaultUpdatedAt func() time.Time
	// FeatureKeyValidator is a validator for the "feature_key" field. It is called by the builders before save.
	FeatureKeyValidator func(string) error
	// FeatureIDValidator is a validator for the "feature_id" field. It is called by the builders before save.
	FeatureIDValidator func(string) error
	// DefaultID holds the default value on creation for the "id" field.
	DefaultID func() string
	// ValueScanner of all ChargeUsageBased fields.
	ValueScanner struct {
		Discounts  field.TypeValueScanner[*billing.Discounts]
		Price      field.TypeValueScanner[*productcatalog.Price]
		UnitConfig field.TypeValueScanner[*productcatalog.UnitConfig]
	}
)

// StatusValidator is a validator for the "status" field enum values. It is called by the builders before save.
func StatusValidator(s meta.ChargeStatus) error {
	switch s {
	case "created", "active", "final", "deleted":
		return nil
	default:
		return fmt.Errorf("chargeusagebased: invalid enum value for status field: %q", s)
	}
}

// ManagedByValidator is a validator for the "managed_by" field enum values. It is called by the builders before save.
func ManagedByValidator(mb billing.InvoiceLineManagedBy) error {
	switch mb {
	case "subscription", "system", "manual":
		return nil
	default:
		return fmt.Errorf("chargeusagebased: invalid enum value for managed_by field: %q", mb)
	}
}

// TaxBehaviorValidator is a validator for the "tax_behavior" field enum values. It is called by the builders before save.
func TaxBehaviorValidator(tb productcatalog.TaxBehavior) error {
	switch tb {
	case "inclusive", "exclusive":
		return nil
	default:
		return fmt.Errorf("chargeusagebased: invalid enum value for tax_behavior field: %q", tb)
	}
}

// SettlementModeValidator is a validator for the "settlement_mode" field enum values. It is called by the builders before save.
func SettlementModeValidator(sm productcatalog.SettlementMode) error {
	switch sm {
	case "credit_then_invoice", "credit_only":
		return nil
	default:
		return fmt.Errorf("chargeusagebased: invalid enum value for settlement_mode field: %q", sm)
	}
}

// RatingEngineValidator is a validator for the "rating_engine" field enum values. It is called by the builders before save.
func RatingEngineValidator(re usagebased.RatingEngine) error {
	switch re {
	case "delta", "period_preserving":
		return nil
	default:
		return fmt.Errorf("chargeusagebased: invalid enum value for rating_engine field: %q", re)
	}
}

// StatusDetailedValidator is a validator for the "status_detailed" field enum values. It is called by the builders before save.
func StatusDetailedValidator(sd usagebased.Status) error {
	switch sd {
	case "created", "active", "active.realization.started", "active.realization.waiting_for_collection", "active.realization.processing", "active.realization.issuing", "active.realization.completed", "active.awaiting_payment_settlement", "final", "deleted":
		return nil
	default:
		return fmt.Errorf("chargeusagebased: invalid enum value for status_detailed field: %q", sd)
	}
}

// OrderOption defines the ordering options for the ChargeUsageBased queries.
type OrderOption func(*sql.Selector)

// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldID, opts...).ToFunc()
}

// ByCustomerID orders the results by the customer_id field.
func ByCustomerID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCustomerID, opts...).ToFunc()
}

// ByServicePeriodFrom orders the results by the service_period_from field.
func ByServicePeriodFrom(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldServicePeriodFrom, opts...).ToFunc()
}

// ByServicePeriodTo orders the results by the service_period_to field.
func ByServicePeriodTo(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldServicePeriodTo, opts...).ToFunc()
}

// ByBillingPeriodFrom orders the results by the billing_period_from field.
func ByBillingPeriodFrom(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldBillingPeriodFrom, opts...).ToFunc()
}

// ByBillingPeriodTo orders the results by the billing_period_to field.
func ByBillingPeriodTo(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldBillingPeriodTo, opts...).ToFunc()
}

// ByFullServicePeriodFrom orders the results by the full_service_period_from field.
func ByFullServicePeriodFrom(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldFullServicePeriodFrom, opts...).ToFunc()
}

// ByFullServicePeriodTo orders the results by the full_service_period_to field.
func ByFullServicePeriodTo(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldFullServicePeriodTo, opts...).ToFunc()
}

// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldStatus, opts...).ToFunc()
}

// ByUniqueReferenceID orders the results by the unique_reference_id field.
func ByUniqueReferenceID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldUniqueReferenceID, opts...).ToFunc()
}

// ByCurrency orders the results by the currency field.
func ByCurrency(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCurrency, opts...).ToFunc()
}

// ByManagedBy orders the results by the managed_by field.
func ByManagedBy(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldManagedBy, opts...).ToFunc()
}

// BySubscriptionID orders the results by the subscription_id field.
func BySubscriptionID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSubscriptionID, opts...).ToFunc()
}

// BySubscriptionPhaseID orders the results by the subscription_phase_id field.
func BySubscriptionPhaseID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSubscriptionPhaseID, opts...).ToFunc()
}

// BySubscriptionItemID orders the results by the subscription_item_id field.
func BySubscriptionItemID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSubscriptionItemID, opts...).ToFunc()
}

// ByAdvanceAfter orders the results by the advance_after field.
func ByAdvanceAfter(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldAdvanceAfter, opts...).ToFunc()
}

// ByTaxCodeID orders the results by the tax_code_id field.
func ByTaxCodeID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldTaxCodeID, opts...).ToFunc()
}

// ByTaxBehavior orders the results by the tax_behavior field.
func ByTaxBehavior(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldTaxBehavior, opts...).ToFunc()
}

// ByNamespace orders the results by the namespace field.
func ByNamespace(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldNamespace, opts...).ToFunc()
}

// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}

// ByUpdatedAt orders the results by the updated_at field.
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
}

// ByDeletedAt orders the results by the deleted_at field.
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
}

// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldName, opts...).ToFunc()
}

// ByDescription orders the results by the description field.
func ByDescription(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDescription, opts...).ToFunc()
}

// ByInvoiceAt orders the results by the invoice_at field.
func ByInvoiceAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldInvoiceAt, opts...).ToFunc()
}

// BySettlementMode orders the results by the settlement_mode field.
func BySettlementMode(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSettlementMode, opts...).ToFunc()
}

// ByIntentDeletedAt orders the results by the intent_deleted_at field.
func ByIntentDeletedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldIntentDeletedAt, opts...).ToFunc()
}

// ByDiscounts orders the results by the discounts field.
func ByDiscounts(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDiscounts, opts...).ToFunc()
}

// ByFeatureKey orders the results by the feature_key field.
func ByFeatureKey(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldFeatureKey, opts...).ToFunc()
}

// ByFeatureID orders the results by the feature_id field.
func ByFeatureID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldFeatureID, opts...).ToFunc()
}

// ByRatingEngine orders the results by the rating_engine field.
func ByRatingEngine(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldRatingEngine, opts...).ToFunc()
}

// ByPrice orders the results by the price field.
func ByPrice(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPrice, opts...).ToFunc()
}

// ByUnitConfig orders the results by the unit_config field.
func ByUnitConfig(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldUnitConfig, opts...).ToFunc()
}

// ByCurrentRealizationRunID orders the results by the current_realization_run_id field.
func ByCurrentRealizationRunID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCurrentRealizationRunID, opts...).ToFunc()
}

// ByStatusDetailed orders the results by the status_detailed field.
func ByStatusDetailed(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldStatusDetailed, opts...).ToFunc()
}

// ByRunsCount orders the results by runs count.
func ByRunsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newRunsStep(), opts...)
	}
}

// ByRuns orders the results by runs terms.
func ByRuns(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newRunsStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}

// ByDetailedLinesCount orders the results by detailed_lines count.
func ByDetailedLinesCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newDetailedLinesStep(), opts...)
	}
}

// ByDetailedLines orders the results by detailed_lines terms.
func ByDetailedLines(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newDetailedLinesStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}

// ByCurrentRunField orders the results by current_run field.
func ByCurrentRunField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newCurrentRunStep(), sql.OrderByField(field, opts...))
	}
}

// ByChargeField orders the results by charge field.
func ByChargeField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newChargeStep(), sql.OrderByField(field, opts...))
	}
}

// ByIntentOverrideField orders the results by intent_override field.
func ByIntentOverrideField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newIntentOverrideStep(), sql.OrderByField(field, opts...))
	}
}

// BySubscriptionField orders the results by subscription field.
func BySubscriptionField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newSubscriptionStep(), sql.OrderByField(field, opts...))
	}
}

// BySubscriptionPhaseField orders the results by subscription_phase field.
func BySubscriptionPhaseField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newSubscriptionPhaseStep(), sql.OrderByField(field, opts...))
	}
}

// BySubscriptionItemField orders the results by subscription_item field.
func BySubscriptionItemField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newSubscriptionItemStep(), sql.OrderByField(field, opts...))
	}
}

// ByCustomerField orders the results by customer field.
func ByCustomerField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newCustomerStep(), sql.OrderByField(field, opts...))
	}
}

// ByFeatureField orders the results by feature field.
func ByFeatureField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newFeatureStep(), sql.OrderByField(field, opts...))
	}
}

// ByTaxCodeField orders the results by tax_code field.
func ByTaxCodeField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newTaxCodeStep(), sql.OrderByField(field, opts...))
	}
}
func newRunsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(RunsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, RunsTable, RunsColumn),
	)
}
func newDetailedLinesStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(DetailedLinesInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, DetailedLinesTable, DetailedLinesColumn),
	)
}
func newCurrentRunStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(CurrentRunInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, false, CurrentRunTable, CurrentRunColumn),
	)
}
func newChargeStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(ChargeInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2O, false, ChargeTable, ChargeColumn),
	)
}
func newIntentOverrideStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(IntentOverrideInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2O, false, IntentOverrideTable, IntentOverrideColumn),
	)
}
func newSubscriptionStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(SubscriptionInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, SubscriptionTable, SubscriptionColumn),
	)
}
func newSubscriptionPhaseStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(SubscriptionPhaseInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, SubscriptionPhaseTable, SubscriptionPhaseColumn),
	)
}
func newSubscriptionItemStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(SubscriptionItemInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, SubscriptionItemTable, SubscriptionItemColumn),
	)
}
func newCustomerStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(CustomerInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, CustomerTable, CustomerColumn),
	)
}
func newFeatureStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(FeatureInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, FeatureTable, FeatureColumn),
	)
}
func newTaxCodeStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(TaxCodeInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, TaxCodeTable, TaxCodeColumn),
	)
}