@@ -78,6 +78,46 @@ public required string ID
7878 }
7979 }
8080
81+ public required BasePlan ? BasePlan
82+ {
83+ get
84+ {
85+ if ( ! this . _properties . TryGetValue ( "base_plan" , out JsonElement element ) )
86+ return null ;
87+
88+ return JsonSerializer . Deserialize < BasePlan ? > ( element , ModelBase . SerializerOptions ) ;
89+ }
90+ init
91+ {
92+ this . _properties [ "base_plan" ] = JsonSerializer . SerializeToElement (
93+ value ,
94+ ModelBase . SerializerOptions
95+ ) ;
96+ }
97+ }
98+
99+ /// <summary>
100+ /// The parent plan id if the given plan was created by overriding one or more
101+ /// of the parent's prices
102+ /// </summary>
103+ public required string ? BasePlanID
104+ {
105+ get
106+ {
107+ if ( ! this . _properties . TryGetValue ( "base_plan_id" , out JsonElement element ) )
108+ return null ;
109+
110+ return JsonSerializer . Deserialize < string ? > ( element , ModelBase . SerializerOptions ) ;
111+ }
112+ init
113+ {
114+ this . _properties [ "base_plan_id" ] = JsonSerializer . SerializeToElement (
115+ value ,
116+ ModelBase . SerializerOptions
117+ ) ;
118+ }
119+ }
120+
81121 public required System ::DateTimeOffset CreatedAt
82122 {
83123 get
@@ -572,53 +612,15 @@ public required long Version
572612 }
573613 }
574614
575- public BasePlan ? BasePlan
576- {
577- get
578- {
579- if ( ! this . _properties . TryGetValue ( "base_plan" , out JsonElement element ) )
580- return null ;
581-
582- return JsonSerializer . Deserialize < BasePlan ? > ( element , ModelBase . SerializerOptions ) ;
583- }
584- init
585- {
586- this . _properties [ "base_plan" ] = JsonSerializer . SerializeToElement (
587- value ,
588- ModelBase . SerializerOptions
589- ) ;
590- }
591- }
592-
593- /// <summary>
594- /// The parent plan id if the given plan was created by overriding one or more
595- /// of the parent's prices
596- /// </summary>
597- public string ? BasePlanID
598- {
599- get
600- {
601- if ( ! this . _properties . TryGetValue ( "base_plan_id" , out JsonElement element ) )
602- return null ;
603-
604- return JsonSerializer . Deserialize < string ? > ( element , ModelBase . SerializerOptions ) ;
605- }
606- init
607- {
608- this . _properties [ "base_plan_id" ] = JsonSerializer . SerializeToElement (
609- value ,
610- ModelBase . SerializerOptions
611- ) ;
612- }
613- }
614-
615615 public override void Validate ( )
616616 {
617617 _ = this . ID ;
618618 foreach ( var item in this . Adjustments )
619619 {
620620 item . Validate ( ) ;
621621 }
622+ this . BasePlan ? . Validate ( ) ;
623+ _ = this . BasePlanID ;
622624 _ = this . CreatedAt ;
623625 _ = this . Currency ;
624626 _ = this . DefaultInvoiceMemo ;
@@ -645,8 +647,6 @@ public override void Validate()
645647 this . Status . Validate ( ) ;
646648 this . TrialConfig . Validate ( ) ;
647649 _ = this . Version ;
648- this . BasePlan ? . Validate ( ) ;
649- _ = this . BasePlanID ;
650650 }
651651
652652 public Plan ( ) { }
@@ -1088,6 +1088,96 @@ JsonSerializerOptions options
10881088 }
10891089}
10901090
1091+ [ JsonConverter ( typeof ( ModelConverter < BasePlan > ) ) ]
1092+ public sealed record class BasePlan : ModelBase , IFromRaw < BasePlan >
1093+ {
1094+ public required string ? ID
1095+ {
1096+ get
1097+ {
1098+ if ( ! this . _properties . TryGetValue ( "id" , out JsonElement element ) )
1099+ return null ;
1100+
1101+ return JsonSerializer . Deserialize < string ? > ( element , ModelBase . SerializerOptions ) ;
1102+ }
1103+ init
1104+ {
1105+ this . _properties [ "id" ] = JsonSerializer . SerializeToElement (
1106+ value ,
1107+ ModelBase . SerializerOptions
1108+ ) ;
1109+ }
1110+ }
1111+
1112+ /// <summary>
1113+ /// An optional user-defined ID for this plan resource, used throughout the system
1114+ /// as an alias for this Plan. Use this field to identify a plan by an existing
1115+ /// identifier in your system.
1116+ /// </summary>
1117+ public required string ? ExternalPlanID
1118+ {
1119+ get
1120+ {
1121+ if ( ! this . _properties . TryGetValue ( "external_plan_id" , out JsonElement element ) )
1122+ return null ;
1123+
1124+ return JsonSerializer . Deserialize < string ? > ( element , ModelBase . SerializerOptions ) ;
1125+ }
1126+ init
1127+ {
1128+ this . _properties [ "external_plan_id" ] = JsonSerializer . SerializeToElement (
1129+ value ,
1130+ ModelBase . SerializerOptions
1131+ ) ;
1132+ }
1133+ }
1134+
1135+ public required string ? Name
1136+ {
1137+ get
1138+ {
1139+ if ( ! this . _properties . TryGetValue ( "name" , out JsonElement element ) )
1140+ return null ;
1141+
1142+ return JsonSerializer . Deserialize < string ? > ( element , ModelBase . SerializerOptions ) ;
1143+ }
1144+ init
1145+ {
1146+ this . _properties [ "name" ] = JsonSerializer . SerializeToElement (
1147+ value ,
1148+ ModelBase . SerializerOptions
1149+ ) ;
1150+ }
1151+ }
1152+
1153+ public override void Validate ( )
1154+ {
1155+ _ = this . ID ;
1156+ _ = this . ExternalPlanID ;
1157+ _ = this . Name ;
1158+ }
1159+
1160+ public BasePlan ( ) { }
1161+
1162+ public BasePlan ( IReadOnlyDictionary < string , JsonElement > properties )
1163+ {
1164+ this . _properties = [ .. properties ] ;
1165+ }
1166+
1167+ #pragma warning disable CS8618
1168+ [ SetsRequiredMembers ]
1169+ BasePlan ( FrozenDictionary < string , JsonElement > properties )
1170+ {
1171+ this . _properties = [ .. properties ] ;
1172+ }
1173+ #pragma warning restore CS8618
1174+
1175+ public static BasePlan FromRawUnchecked ( IReadOnlyDictionary < string , JsonElement > properties )
1176+ {
1177+ return new ( FrozenDictionary . ToFrozenDictionary ( properties ) ) ;
1178+ }
1179+ }
1180+
10911181[ JsonConverter ( typeof ( ModelConverter < PlanPhaseModel > ) ) ]
10921182public sealed record class PlanPhaseModel : ModelBase , IFromRaw < PlanPhaseModel >
10931183{
@@ -1680,93 +1770,3 @@ JsonSerializerOptions options
16801770 ) ;
16811771 }
16821772}
1683-
1684- [ JsonConverter ( typeof ( ModelConverter < BasePlan > ) ) ]
1685- public sealed record class BasePlan : ModelBase , IFromRaw < BasePlan >
1686- {
1687- public required string ? ID
1688- {
1689- get
1690- {
1691- if ( ! this . _properties . TryGetValue ( "id" , out JsonElement element ) )
1692- return null ;
1693-
1694- return JsonSerializer . Deserialize < string ? > ( element , ModelBase . SerializerOptions ) ;
1695- }
1696- init
1697- {
1698- this . _properties [ "id" ] = JsonSerializer . SerializeToElement (
1699- value ,
1700- ModelBase . SerializerOptions
1701- ) ;
1702- }
1703- }
1704-
1705- /// <summary>
1706- /// An optional user-defined ID for this plan resource, used throughout the system
1707- /// as an alias for this Plan. Use this field to identify a plan by an existing
1708- /// identifier in your system.
1709- /// </summary>
1710- public required string ? ExternalPlanID
1711- {
1712- get
1713- {
1714- if ( ! this . _properties . TryGetValue ( "external_plan_id" , out JsonElement element ) )
1715- return null ;
1716-
1717- return JsonSerializer . Deserialize < string ? > ( element , ModelBase . SerializerOptions ) ;
1718- }
1719- init
1720- {
1721- this . _properties [ "external_plan_id" ] = JsonSerializer . SerializeToElement (
1722- value ,
1723- ModelBase . SerializerOptions
1724- ) ;
1725- }
1726- }
1727-
1728- public required string ? Name
1729- {
1730- get
1731- {
1732- if ( ! this . _properties . TryGetValue ( "name" , out JsonElement element ) )
1733- return null ;
1734-
1735- return JsonSerializer . Deserialize < string ? > ( element , ModelBase . SerializerOptions ) ;
1736- }
1737- init
1738- {
1739- this . _properties [ "name" ] = JsonSerializer . SerializeToElement (
1740- value ,
1741- ModelBase . SerializerOptions
1742- ) ;
1743- }
1744- }
1745-
1746- public override void Validate ( )
1747- {
1748- _ = this . ID ;
1749- _ = this . ExternalPlanID ;
1750- _ = this . Name ;
1751- }
1752-
1753- public BasePlan ( ) { }
1754-
1755- public BasePlan ( IReadOnlyDictionary < string , JsonElement > properties )
1756- {
1757- this . _properties = [ .. properties ] ;
1758- }
1759-
1760- #pragma warning disable CS8618
1761- [ SetsRequiredMembers ]
1762- BasePlan ( FrozenDictionary < string , JsonElement > properties )
1763- {
1764- this . _properties = [ .. properties ] ;
1765- }
1766- #pragma warning restore CS8618
1767-
1768- public static BasePlan FromRawUnchecked ( IReadOnlyDictionary < string , JsonElement > properties )
1769- {
1770- return new ( FrozenDictionary . ToFrozenDictionary ( properties ) ) ;
1771- }
1772- }
0 commit comments