@casomoltd/nhs-pay 0.29.0 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,22 @@
1
1
  /**
2
2
  * Each section's award for a member, valued at one set of dates: the
3
3
  * legacy section on final salary, the 2015 Section and a remedy window
4
- * on its basis as career average walks, and today's holdings. The
5
- * owner in `benefits.ts` decides which awards a drawing has and
6
- * sums them.
4
+ * on its basis as career average walks. Beside them, what the member
5
+ * holds before any drawing: today's holdings, and the final-salary value
6
+ * and undrawn walk a tax year's pension input reads on a date. `Built`
7
+ * is everything about the member, derived once, that all of it reads.
8
+ * The owner in `benefits.ts` decides which awards a drawing has and sums
9
+ * them.
7
10
  */
8
- import type { Award, Holdings, Member, Position, ServicePeriod } from './types.js';
9
- import type { LegacySectionId, SectionId } from './types.js';
11
+ import type { Award, Holdings, Member, MemberBenefits, Position, ServicePeriod } from './types.js';
12
+ import type { LegacySectionId, RemedyBasis, SectionId } from './types.js';
10
13
  import type { LegacyHolding } from './service.js';
11
14
  import type { JoiningHistory } from '../pension/ages.js';
12
15
  import type { PayPath } from '../pay-path.js';
16
+ import type { MemberLedger } from '../pension/ledger.js';
13
17
  import type { Prices } from '../pension/prices.js';
14
18
  import type { LedgerSeed } from '../pension/seed.js';
15
- import type { FinalSalaryRules } from '../sections/final-salary.js';
19
+ import type { FinalSalaryRules, UnreducedPension } from '../sections/final-salary.js';
16
20
  import { careerAverage } from '../sections/section-2015.js';
17
21
  /** Everything about the member, derived once, that every question
18
22
  * asked of them reads. */
@@ -25,6 +29,9 @@ export interface Built {
25
29
  readonly npaOn: Date;
26
30
  readonly payPath: PayPath;
27
31
  readonly legacy: LegacyHolding | null;
32
+ /** Whether the member has a remedy window, and so must elect a basis
33
+ * for it, as every refusal of an election reads it. */
34
+ readonly remedy: boolean;
28
35
  readonly ordinary2015: ServicePeriod;
29
36
  readonly cashPrices: Prices;
30
37
  readonly todaysPrices: Prices;
@@ -49,19 +56,68 @@ interface CareerWindow {
49
56
  readonly window: ServicePeriod;
50
57
  readonly seedFor: (prices: Prices) => LedgerSeed;
51
58
  }
59
+ /** One walk: a window, its seed, and the price series it walks in. */
60
+ interface Walk {
61
+ readonly window: ServicePeriod;
62
+ readonly seed: LedgerSeed;
63
+ readonly prices: Prices;
64
+ }
65
+ /** The legacy periods valued on final salary, which the election decides,
66
+ * and the section whose rules value them. */
67
+ interface FinalSalaryValued {
68
+ readonly section: LegacySectionId;
69
+ readonly valued: readonly ServicePeriod[];
70
+ }
71
+ /** A final-salary pension and automatic lump sum, unreduced, in today's
72
+ * money. */
73
+ type FinalSalaryHeld = Pick<UnreducedPension, 'pension' | 'automaticLumpSum'>;
52
74
  /** Each legacy section's statute. */
53
75
  export declare const RULES: Record<LegacySectionId, FinalSalaryRules>;
76
+ /** Whether an election walks the remedy window as career average. */
77
+ export declare function walksWindow(basis: RemedyBasis): boolean;
78
+ /** The legacy periods final salary values under an election: every one on
79
+ * the legacy basis; on the 2015 basis the section's own service alone,
80
+ * the remedy window leaving it for a career average walk. */
81
+ export declare function finalSalaryValued(legacy: LegacyHolding, basis: RemedyBasis): FinalSalaryValued;
82
+ /** A remedy window's seed on the 2015 basis: it walks from its first day,
83
+ * since no statement counts the remedy years in the 2015 Section. */
84
+ export declare function windowSeed(window: ServicePeriod): LedgerSeed;
54
85
  /** The 2015 Section's own seed: its statement, or its first day. */
55
86
  export declare function seed2015(b: Built, { leaving, drawing }: Drawing, prices: Prices): LedgerSeed;
56
87
  /** What the member holds today, with the remedy window on the legacy
57
- * basis: unreduced, since nothing is drawn. */
88
+ * basis: unreduced, since nothing is drawn. A member who has left holds
89
+ * their deferred benefits, final pay measured at leaving. */
58
90
  export declare function holdings(b: Built): Holdings;
59
91
  /** The legacy section's final-salary award over the periods valued on
60
92
  * final salary, which the election decides. */
61
- export declare function legacyAward(b: Built, legacy: LegacyHolding, valued: readonly ServicePeriod[], dates: Drawing): Award;
93
+ export declare function legacyAward(b: Built, { section, valued }: FinalSalaryValued, dates: Drawing): Award;
62
94
  /** A career average award over one window, walked in both rulers. */
63
95
  export declare function careerAward(b: Built, { section, window, seedFor }: CareerWindow, dates: Drawing): CareerAward;
64
96
  /** The 2015 Section's balance, with its estimated run-up before a
65
97
  * statement, as the ledgers, history and curve a `Position` carries. */
66
98
  export declare function section2015(b: Built, own: CareerAward, { leaving, drawing }: Drawing): Pick<Position, 'ledger' | 'todaysMoneyLedger' | 'estimatedHistory' | 'curve'>;
99
+ /**
100
+ * The same walk as the ledger alone, with no drawing on it, through the
101
+ * scheme year ending in `through`: what the window holds on any date to
102
+ * then, before any early or late factor. A valuation that never draws has
103
+ * no factor to read, and a factor read for a drawing far past the pension
104
+ * age is one GAD's tables may not price.
105
+ */
106
+ export declare function accruedLedger(b: Built, { window, seed, prices }: Walk, { leaving, drawing }: Drawing, through: number): MemberLedger;
107
+ /** Refuse a leaving after the one the member declared, naming `asked`,
108
+ * the call a caller was answering: service that has ended cannot run on. */
109
+ export declare function refuseLeavingAfterDeclared(asked: keyof MemberBenefits, b: Built, leaving: Date): void;
110
+ /**
111
+ * The legacy section's final-salary pension and automatic lump sum held on
112
+ * `on`, unreduced, in today's money: membership to that day, on final pay
113
+ * measured back from it, as a leaving on it is measured. Where the member
114
+ * `left` before `on`, both are measured at leaving. `left` is the caller's:
115
+ * today's holdings read the declared leaving, and a tax year's input the
116
+ * leaving it was asked about.
117
+ */
118
+ export declare function finalSalaryHeldOn(b: Built, { section, valued }: FinalSalaryValued, on: Date, left: Date | null): FinalSalaryHeld;
119
+ /** The dates a walk that never draws runs to: leaving, and a drawing at
120
+ * the pension age or at leaving where that is later. It reads no factor,
121
+ * so the drawing decides only which years after leaving are deferred. */
122
+ export declare function walkDates(b: Built, leaving: Date): Drawing;
67
123
  export {};
@@ -1,9 +1,10 @@
1
- import { ACCRUALS, SECTIONS } from './types.js';
1
+ import { ACCRUALS, REMEDY_BASES, SECTIONS } from './types.js';
2
2
  import { legacyPeriodsOf, until } from './service.js';
3
3
  import { isoToDate } from '../iso-date.js';
4
4
  import { normalPensionAge } from '../pension/ages.js';
5
5
  import { earliest } from '../dates.js';
6
6
  import { buildCurve, walkThrough } from '../pension/curve.js';
7
+ import { buildLedger } from '../pension/ledger.js';
7
8
  import { seedFromBalanceAt } from '../pension/uplift.js';
8
9
  import { estimateHistory } from '../pension/history.js';
9
10
  import { moneyAt, sumMoney } from '../pension/money.js';
@@ -17,6 +18,33 @@ export const RULES = {
17
18
  [SECTIONS.s1995]: RULES_1995,
18
19
  [SECTIONS.s2008]: RULES_2008,
19
20
  };
21
+ /** How each election values the remedy window: on final salary, as more
22
+ * legacy service, or as a career average walk paid from the legacy
23
+ * section. No election means no window, so nothing walks. Total over
24
+ * `RemedyBasis`, so a new basis fails the build until it says which. */
25
+ const WINDOW_ACCRUAL = {
26
+ [REMEDY_BASES.none]: ACCRUALS.finalSalary,
27
+ [REMEDY_BASES.legacy]: ACCRUALS.finalSalary,
28
+ [REMEDY_BASES.section2015]: ACCRUALS.careerAverage,
29
+ };
30
+ /** Whether an election walks the remedy window as career average. */
31
+ export function walksWindow(basis) {
32
+ return WINDOW_ACCRUAL[basis] === ACCRUALS.careerAverage;
33
+ }
34
+ /** The legacy periods final salary values under an election: every one on
35
+ * the legacy basis; on the 2015 basis the section's own service alone,
36
+ * the remedy window leaving it for a career average walk. */
37
+ export function finalSalaryValued(legacy, basis) {
38
+ return {
39
+ section: legacy.section,
40
+ valued: walksWindow(basis) ? [legacy.own] : legacyPeriodsOf(legacy),
41
+ };
42
+ }
43
+ /** A remedy window's seed on the 2015 basis: it walks from its first day,
44
+ * since no statement counts the remedy years in the 2015 Section. */
45
+ export function windowSeed(window) {
46
+ return seedFromJoinDate(isoToDate(window.from));
47
+ }
20
48
  /** The 2015 Section's own seed: its statement, or its first day. */
21
49
  export function seed2015(b, { leaving, drawing }, prices) {
22
50
  const { statement } = b.member;
@@ -25,13 +53,15 @@ export function seed2015(b, { leaving, drawing }, prices) {
25
53
  : seedFromBalanceAt(statement.accruedPension, isoToDate(statement.asAt), leaving, drawing, prices);
26
54
  }
27
55
  /** What the member holds today, with the remedy window on the legacy
28
- * basis: unreduced, since nothing is drawn. */
56
+ * basis: unreduced, since nothing is drawn. A member who has left holds
57
+ * their deferred benefits, final pay measured at leaving. */
29
58
  export function holdings(b) {
30
59
  const { today } = b;
60
+ const left = declaredLeaving(b);
31
61
  const bySection = [];
32
62
  const flat = (x) => moneyAt({ nominal: x, real: x }, today);
33
63
  if (b.legacy !== null) {
34
- const { pension, automaticLumpSum } = unreducedPension(RULES[b.legacy.section], membershipOf(legacyPeriodsOf(b.legacy), today), b.payPath, schemeYearEndFor(today));
64
+ const { pension, automaticLumpSum } = finalSalaryHeldOn(b, finalSalaryValued(b.legacy, REMEDY_BASES.legacy), today, left);
35
65
  bySection.push({
36
66
  section: b.legacy.section,
37
67
  pension: flat(pension),
@@ -40,10 +70,7 @@ export function holdings(b) {
40
70
  }
41
71
  // Any leaving and drawing after today give the same balance today;
42
72
  // these are only where the walk has to stop.
43
- const leaving = b.ordinary2015.to === null
44
- ? b.npaOn
45
- : isoToDate(b.ordinary2015.to);
46
- const dates = { leaving, drawing: leaving < b.npaOn ? b.npaOn : leaving };
73
+ const dates = walkDates(b, left ?? b.npaOn);
47
74
  const accrued = walk(b, {
48
75
  window: b.ordinary2015,
49
76
  seed: seed2015(b, dates, b.todaysPrices),
@@ -60,21 +87,22 @@ export function holdings(b) {
60
87
  }
61
88
  /** The legacy section's final-salary award over the periods valued on
62
89
  * final salary, which the election decides. */
63
- export function legacyAward(b, legacy, valued, dates) {
64
- const rules = RULES[legacy.section];
90
+ export function legacyAward(b, { section, valued }, dates) {
91
+ const rules = RULES[section];
65
92
  const benefit = finalSalaryBenefit(rules, {
66
93
  windows: membershipOf(valued, dates.leaving),
67
94
  payPath: b.payPath, dateOfBirth: b.born, ...dates,
68
95
  prices: b.cashPrices,
69
96
  });
70
97
  return {
71
- section: legacy.section,
98
+ section,
72
99
  periods: valued,
73
- beforeFactor: benefit.beforeFactor,
100
+ pensionBeforeFactor: benefit.pensionBeforeFactor,
74
101
  pension: benefit.pension,
75
102
  automaticLumpSum: benefit.automaticLumpSum,
76
103
  automaticLumpSumBeforeFactor: benefit.automaticLumpSumBeforeFactor,
77
- factor: benefit.factor,
104
+ pensionFactor: benefit.pensionFactor,
105
+ automaticLumpSumFactor: benefit.automaticLumpSumFactor,
78
106
  ledgers: null,
79
107
  provenance: {
80
108
  accrual: ACCRUALS.finalSalary,
@@ -97,11 +125,12 @@ export function careerAward(b, { section, window, seedFor }, dates) {
97
125
  award: {
98
126
  section,
99
127
  periods: [window],
100
- beforeFactor: moneyAt({ nominal: cash.revalued, real: todays.revalued }, dates.drawing),
128
+ pensionBeforeFactor: moneyAt({ nominal: cash.revalued, real: todays.revalued }, dates.drawing),
101
129
  pension: moneyAt({ nominal: cash.drawn, real: todays.drawn }, dates.drawing),
102
130
  automaticLumpSum: noLumpSum,
103
131
  automaticLumpSumBeforeFactor: noLumpSum,
104
- factor: cash.factor,
132
+ pensionFactor: cash.factor,
133
+ automaticLumpSumFactor: null,
105
134
  ledgers: { cash: cash.ledger, todaysMoney: todays.ledger },
106
135
  provenance: { accrual: ACCRUALS.careerAverage },
107
136
  },
@@ -137,15 +166,62 @@ export function section2015(b, own, { leaving, drawing }) {
137
166
  curve: buildCurve(run(own.cash, cashHistory), run(own.todays, todaysHistory)),
138
167
  };
139
168
  }
169
+ /**
170
+ * The same walk as the ledger alone, with no drawing on it, through the
171
+ * scheme year ending in `through`: what the window holds on any date to
172
+ * then, before any early or late factor. A valuation that never draws has
173
+ * no factor to read, and a factor read for a drawing far past the pension
174
+ * age is one GAD's tables may not price.
175
+ */
176
+ export function accruedLedger(b, { window, seed, prices }, { leaving, drawing }, through) {
177
+ return buildLedger({
178
+ seed,
179
+ payIn: payInside(b, window, leaving),
180
+ exitDate: leaving,
181
+ retirementDate: drawing,
182
+ prices,
183
+ through,
184
+ drawingFor: () => null,
185
+ });
186
+ }
187
+ /** Refuse a leaving after the one the member declared, naming `asked`,
188
+ * the call a caller was answering: service that has ended cannot run on. */
189
+ export function refuseLeavingAfterDeclared(asked, b, leaving) {
190
+ const left = declaredLeaving(b);
191
+ if (left !== null && left < leaving) {
192
+ throw new RangeError(`${asked}: leaving after the member already left, on `
193
+ + `${b.ordinary2015.to}`);
194
+ }
195
+ }
196
+ /**
197
+ * The legacy section's final-salary pension and automatic lump sum held on
198
+ * `on`, unreduced, in today's money: membership to that day, on final pay
199
+ * measured back from it, as a leaving on it is measured. Where the member
200
+ * `left` before `on`, both are measured at leaving. `left` is the caller's:
201
+ * today's holdings read the declared leaving, and a tax year's input the
202
+ * leaving it was asked about.
203
+ */
204
+ export function finalSalaryHeldOn(b, { section, valued }, on, left) {
205
+ const asAt = left === null ? on : earliest(left, on);
206
+ const { pension, automaticLumpSum } = unreducedPension(RULES[section], membershipOf(valued, asAt), b.payPath, asAt);
207
+ return { pension, automaticLumpSum };
208
+ }
209
+ /** The dates a walk that never draws runs to: leaving, and a drawing at
210
+ * the pension age or at leaving where that is later. It reads no factor,
211
+ * so the drawing decides only which years after leaving are deferred. */
212
+ export function walkDates(b, leaving) {
213
+ return { leaving, drawing: leaving < b.npaOn ? b.npaOn : leaving };
214
+ }
215
+ /** The member's last day of service, as they declared it; null while they
216
+ * serve. The 2015 Section is the one every member serves in last. */
217
+ function declaredLeaving(b) {
218
+ return b.ordinary2015.to === null ? null : isoToDate(b.ordinary2015.to);
219
+ }
140
220
  /** A career average walk over `window`, accruing only inside it. */
141
221
  function walk(b, { window, seed, prices }, { leaving, drawing }) {
142
- const first = schemeYearEndFor(isoToDate(window.from));
143
- const last = schemeYearEndFor(until(window, leaving));
144
222
  return careerAverage({
145
223
  seed,
146
- payIn: (year) => (year >= first && year <= last
147
- ? b.payPath.payFor(year)
148
- : null),
224
+ payIn: payInside(b, window, leaving),
149
225
  dateOfBirth: b.born,
150
226
  leaving,
151
227
  drawing,
@@ -153,6 +229,15 @@ function walk(b, { window, seed, prices }, { leaving, drawing }) {
153
229
  through: walkThrough(drawing, b.npaOn),
154
230
  });
155
231
  }
232
+ /** Pay for the scheme years `window` accrues in, to `leaving`; none
233
+ * outside it. */
234
+ function payInside(b, window, leaving) {
235
+ const first = schemeYearEndFor(isoToDate(window.from));
236
+ const last = schemeYearEndFor(until(window, leaving));
237
+ return (year) => (year >= first && year <= last
238
+ ? b.payPath.payFor(year)
239
+ : null);
240
+ }
156
241
  /** The legacy windows as final-salary membership, to `leaving`. */
157
242
  function membershipOf(valued, leaving) {
158
243
  return valued
@@ -1 +1 @@
1
- {"version":3,"file":"valuation.js","sourceRoot":"","sources":["../../src/member/valuation.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAC,eAAe,EAAE,KAAK,EAAC,MAAM,cAAc,CAAC;AACpD,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AACrC,OAAO,EAAC,UAAU,EAAE,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAC,aAAa,EAAC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;SAC3C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,EAAC,CAAC,CAAC,CAAC;AACpE,CAAC"}
@@ -1,34 +1,15 @@
1
- /**
2
- * The final-salary engine the 1995 and 2008 Sections share. What
3
- * differs between them is statute — the denominator, the pay measure,
4
- * the lump sum, which factors apply — and each section holds its own
5
- * rules privately, so no caller can compose a combination the scheme
6
- * lacks, such as a 60 denominator on best-single-year pay.
7
- */
8
1
  import type { FactorOutcome } from '../factor-basis.js';
9
2
  import type { PayPath } from '../pay-path.js';
10
3
  import type { ProjectionMoney } from '../pension/money.js';
11
4
  import type { Prices } from '../pension/prices.js';
12
- /** A window of service valued on final salary, as dates. */
13
- interface Membership {
14
- readonly from: Date;
15
- /** The last day of service in it, inclusive. */
16
- readonly to: Date;
17
- }
18
- /** How a section measures final pay, named for an award's provenance.
19
- * The measuring itself is each section's own `finalPay`. */
20
- export declare const PAY_MEASURES: {
21
- readonly bestSingleOf3: "best-single-of-3";
22
- readonly meanOf3ConsecutiveIn10: "mean-of-3-consecutive-in-10";
23
- };
24
- export type PayMeasure = (typeof PAY_MEASURES)[keyof typeof PAY_MEASURES];
25
- /** A factor for a final-salary benefit drawn on `drawn`. */
26
- type FactorFor = (dateOfBirth: Date, leaving: Date, drawn: Date) => FactorOutcome;
5
+ /** The fraction of final pay a year of membership earns: an 80th in the
6
+ * 1995 Section, a 60th in the 2008. */
7
+ type Denominator = 80 | 60;
27
8
  /** One section's statute, private to that section: each rule is the
28
9
  * section's own behaviour, so the engine never branches on which
29
10
  * section it is valuing. */
30
11
  export interface FinalSalaryRules {
31
- readonly denominator: 80 | 60;
12
+ readonly denominator: Denominator;
32
13
  readonly payMeasure: PayMeasure;
33
14
  /** The age the section's pension is payable unreduced, in whole
34
15
  * years: what its early and late factors are measured from. */
@@ -37,9 +18,8 @@ export interface FinalSalaryRules {
37
18
  * section's `pensionFactor` must agree, which
38
19
  * `section-factors.test.ts` asserts. */
39
20
  readonly lateUplift: boolean;
40
- /** Final pay in today's money over the scheme years up to and
41
- * including `lastYear`. */
42
- finalPay(payPath: PayPath, lastYear: number): number;
21
+ /** Final pay in today's money, measured back from `leaving`. */
22
+ finalPay(payPath: PayPath, leaving: Date): number;
43
23
  readonly pensionFactor: FactorFor;
44
24
  /** The automatic lump sum, as a multiple of the unreduced pension,
45
25
  * and the factor it is reduced by; null where the section pays
@@ -49,35 +29,40 @@ export interface FinalSalaryRules {
49
29
  readonly factor: FactorFor;
50
30
  } | null;
51
31
  }
52
- /** The 1995 Section's measure: the best single year of the last
53
- * three. */
54
- export declare function bestSingleOf3(payPath: PayPath, lastYear: number): number;
55
- /** The 2008 Section's measure: the best average of three consecutive
56
- * years in the last ten, each "revalued to current terms", which a
57
- * path already in today's money is. */
58
- export declare function meanOf3ConsecutiveIn10(payPath: PayPath, lastYear: number): number;
59
- /**
60
- * A final-salary pension before any factor, in today's money: the
61
- * membership, over the denominator, times final pay measured at
62
- * `lastYear`. The one place the formula is written, so the pension
63
- * held today and the pension drawn cannot come to disagree.
64
- */
65
- export declare function unreducedPension(rules: FinalSalaryRules, windows: readonly Membership[], payPath: PayPath, lastYear: number): {
66
- membership: number;
67
- finalPay: number;
68
- pension: number;
69
- automaticLumpSum: number;
70
- };
32
+ /** A factor for a final-salary benefit drawn on `drawn`. */
33
+ type FactorFor = (dateOfBirth: Date, leaving: Date, drawn: Date) => FactorOutcome;
34
+ /** A window of service valued on final salary, as dates. */
35
+ export interface Membership {
36
+ readonly from: Date;
37
+ /** The last day of service in it, inclusive. */
38
+ readonly to: Date;
39
+ }
40
+ /** A final-salary pension before any factor, and what it is measured
41
+ * from, in today's money. */
42
+ export interface UnreducedPension {
43
+ readonly membership: number;
44
+ readonly finalPay: number;
45
+ readonly pension: number;
46
+ readonly automaticLumpSum: number;
47
+ }
71
48
  /** A final-salary pension and lump sum, before and after factors. */
72
49
  interface FinalSalaryBenefit {
73
- readonly beforeFactor: ProjectionMoney;
50
+ readonly pensionBeforeFactor: ProjectionMoney;
74
51
  readonly pension: ProjectionMoney;
75
52
  readonly automaticLumpSum: ProjectionMoney;
76
53
  readonly automaticLumpSumBeforeFactor: ProjectionMoney;
77
- readonly factor: FactorOutcome;
54
+ readonly pensionFactor: FactorOutcome;
55
+ readonly automaticLumpSumFactor: FactorOutcome | null;
78
56
  readonly membership: number;
79
57
  readonly finalPay: number;
80
58
  }
59
+ /** How a section measures final pay, named for an award's provenance.
60
+ * The measuring itself is each section's own `finalPay`. */
61
+ export declare const PAY_MEASURES: {
62
+ readonly bestSingleOf3: "best-single-of-3";
63
+ readonly meanOf3ConsecutiveIn10: "mean-of-3-consecutive-in-10";
64
+ };
65
+ export type PayMeasure = (typeof PAY_MEASURES)[keyof typeof PAY_MEASURES];
81
66
  /**
82
67
  * Value final-salary membership at a drawing.
83
68
  *
@@ -95,4 +80,36 @@ export declare function finalSalaryBenefit(rules: FinalSalaryRules, { windows, p
95
80
  readonly drawing: Date;
96
81
  readonly prices: Prices;
97
82
  }): FinalSalaryBenefit;
83
+ /**
84
+ * A final-salary pension before any factor, in today's money: the
85
+ * membership, over the denominator, times final pay measured back from
86
+ * `leaving`. The one place the formula is written, so the pension
87
+ * held today and the pension drawn cannot come to disagree.
88
+ */
89
+ export declare function unreducedPension(rules: FinalSalaryRules, windows: readonly Membership[], payPath: PayPath, leaving: Date): UnreducedPension;
90
+ /**
91
+ * The 1995 Section's measure: the best single year of the last three,
92
+ * each year the 12 months ending on a leaving anniversary. SI 1995/300
93
+ * reg C1(6): "final year's pensionable pay" is "pensionable pay in
94
+ * respect of the member's last year of pensionable employment, ending on
95
+ * the date the member ceases to be in such employment", unless "pensionable
96
+ * pay was greater in either or both of the 2 consecutive years immediately
97
+ * preceding the last year".
98
+ */
99
+ export declare function bestSingleOf3(payPath: PayPath, leaving: Date): number;
100
+ /**
101
+ * The 2008 Section's measure: the best average of three consecutive
102
+ * years in the last ten, measured back from leaving, each "revalued to
103
+ * current terms", which a path already in today's money is. SI 2008/653
104
+ * reg 2.A.10(5)(b) compares "the period of 1095 days immediately
105
+ * preceding the relevant day (Period 1)", then "the period of 1095 days
106
+ * which overlaps Period 1 by 730 days (Period 2)", "and so on", and
107
+ * 2.A.10(6) takes the one that begins "within the period of 10 years
108
+ * ending with the relevant day" with the highest pay; for a leaver,
109
+ * 2.A.10(5)(a)(i) makes the relevant day "the day on which the member's
110
+ * active membership ceases". The short-service rule of 2.A.10(7), for
111
+ * under 1095 days' service in the ten years, is not modelled: it moves
112
+ * only a member with less than three years' service before leaving.
113
+ */
114
+ export declare function meanOf3ConsecutiveIn10(payPath: PayPath, leaving: Date): number;
98
115
  export {};