From 627fca2d7c75bb54f4821cedeb5db608bc60195e Mon Sep 17 00:00:00 2001 From: Adam Cooper Date: Mon, 16 Dec 2024 18:08:45 +0000 Subject: [PATCH] Tidy up entity handling around enum casting and life sustaining treatment --- .../Casters/CastToAttorneyActDecisions.php | 19 - .../src/Entity/Casters/CastToCaseSubtype.php | 12 +- .../Casters/CastToLifeSustainingTreatment.php | 9 + .../src/App/src/Entity/LpaStore/LpaStore.php | 3 - .../CastToSiriusLifeSustainingTreatment.php | 19 - .../src/App/src/Entity/Sirius/SiriusLpa.php | 4 +- .../App/src/Enum/LifeSustainingTreatment.php | 11 - service-api/app/src/App/src/Enum/LpaType.php | 11 - ...astToSiriusLifeSustainingTreatmentTest.php | 34 -- .../CanHydrateSiriusToModerniseFormatTest.php | 2 +- .../Entity/CastToWhenTheLpaCanBeUsedTest.php | 34 -- .../Service/Lpa/CombinedSiriusLpaTest.php | 2 +- .../CombinedLpaHasActorTraitTest.php | 402 +++++++++--------- 13 files changed, 225 insertions(+), 337 deletions(-) delete mode 100644 service-api/app/src/App/src/Entity/Casters/CastToAttorneyActDecisions.php delete mode 100644 service-api/app/src/App/src/Entity/Sirius/Casters/CastToSiriusLifeSustainingTreatment.php delete mode 100644 service-api/app/test/AppTest/Entity/CanCastToSiriusLifeSustainingTreatmentTest.php delete mode 100644 service-api/app/test/AppTest/Entity/CastToWhenTheLpaCanBeUsedTest.php diff --git a/service-api/app/src/App/src/Entity/Casters/CastToAttorneyActDecisions.php b/service-api/app/src/App/src/Entity/Casters/CastToAttorneyActDecisions.php deleted file mode 100644 index 66a367b6c8..0000000000 --- a/service-api/app/src/App/src/Entity/Casters/CastToAttorneyActDecisions.php +++ /dev/null @@ -1,19 +0,0 @@ -value; - } -} diff --git a/service-api/app/src/App/src/Entity/Casters/CastToCaseSubtype.php b/service-api/app/src/App/src/Entity/Casters/CastToCaseSubtype.php index d7f192be21..d45bf6aff6 100644 --- a/service-api/app/src/App/src/Entity/Casters/CastToCaseSubtype.php +++ b/service-api/app/src/App/src/Entity/Casters/CastToCaseSubtype.php @@ -8,12 +8,22 @@ use Attribute; use EventSauce\ObjectHydrator\ObjectMapper; use EventSauce\ObjectHydrator\PropertyCaster; +use InvalidArgumentException; #[Attribute(Attribute::TARGET_PARAMETER)] class CastToCaseSubtype implements PropertyCaster { public function cast(mixed $value, ObjectMapper $hydrator): string { - return LpaType::fromShortName($value)->value; + if (is_null(LpaType::tryFrom($value))) { + $value = match ($value) { + 'personal-welfare' => LpaType::PERSONAL_WELFARE->value, + 'property-and-affairs' => LpaType::PROPERTY_AND_AFFAIRS->value, + default => + throw new InvalidArgumentException('Invalid shorthand name: ' . $value), + }; + } + + return LpaType::from($value)->value; } } diff --git a/service-api/app/src/App/src/Entity/Casters/CastToLifeSustainingTreatment.php b/service-api/app/src/App/src/Entity/Casters/CastToLifeSustainingTreatment.php index 9957f76eff..ceadd77621 100644 --- a/service-api/app/src/App/src/Entity/Casters/CastToLifeSustainingTreatment.php +++ b/service-api/app/src/App/src/Entity/Casters/CastToLifeSustainingTreatment.php @@ -8,12 +8,21 @@ use Attribute; use EventSauce\ObjectHydrator\ObjectMapper; use EventSauce\ObjectHydrator\PropertyCaster; +use InvalidArgumentException; #[Attribute(Attribute::TARGET_PARAMETER)] class CastToLifeSustainingTreatment implements PropertyCaster { public function cast(mixed $value, ObjectMapper $hydrator): mixed { + if (is_null(LifeSustainingTreatment::tryFrom($value))) { + $value = match ($value) { + 'Option A' => LifeSustainingTreatment::OPTION_A->value, + 'Option B' => LifeSustainingTreatment::OPTION_B->value, + default => throw new InvalidArgumentException('Invalid shorthand name: ' . $value), + }; + } + return LifeSustainingTreatment::from($value)->value; } } diff --git a/service-api/app/src/App/src/Entity/LpaStore/LpaStore.php b/service-api/app/src/App/src/Entity/LpaStore/LpaStore.php index 5337dcae8e..5f045a7092 100644 --- a/service-api/app/src/App/src/Entity/LpaStore/LpaStore.php +++ b/service-api/app/src/App/src/Entity/LpaStore/LpaStore.php @@ -6,14 +6,12 @@ use App\Entity\Casters\CastToCaseSubtype; use App\Entity\Casters\CastToLifeSustainingTreatment; -use App\Entity\Casters\CastToAttorneyActDecisions; use App\Entity\Lpa; use App\Enum\ActorStatus; use App\Enum\HowAttorneysMakeDecisions; use App\Enum\LifeSustainingTreatment; use App\Enum\LpaType; use App\Enum\WhenTheLpaCanBeUsed; -use App\Service\Lpa\GetAttorneyStatus\AttorneyStatus; use App\Service\Lpa\GetAttorneyStatus\GetAttorneyStatusInterface; use App\Service\Lpa\ResolveActor\ResolveActorInterface; use DateTimeImmutable; @@ -31,7 +29,6 @@ public function __construct( LpaType $caseSubtype, string $channel, LpaStoreDonor $donor, - #[CastToAttorneyActDecisions] ?HowAttorneysMakeDecisions $howAttorneysMakeDecisions, #[MapFrom('lifeSustainingTreatmentOption')] #[CastToLifeSustainingTreatment] diff --git a/service-api/app/src/App/src/Entity/Sirius/Casters/CastToSiriusLifeSustainingTreatment.php b/service-api/app/src/App/src/Entity/Sirius/Casters/CastToSiriusLifeSustainingTreatment.php deleted file mode 100644 index 39ec2b05d6..0000000000 --- a/service-api/app/src/App/src/Entity/Sirius/Casters/CastToSiriusLifeSustainingTreatment.php +++ /dev/null @@ -1,19 +0,0 @@ -value; - } -} diff --git a/service-api/app/src/App/src/Entity/Sirius/SiriusLpa.php b/service-api/app/src/App/src/Entity/Sirius/SiriusLpa.php index e68669b2e3..eaf2e09935 100644 --- a/service-api/app/src/App/src/Entity/Sirius/SiriusLpa.php +++ b/service-api/app/src/App/src/Entity/Sirius/SiriusLpa.php @@ -4,6 +4,7 @@ namespace App\Entity\Sirius; +use App\Entity\Casters\CastToLifeSustainingTreatment; use App\Entity\Casters\CastToWhenTheLpaCanBeUsed; use App\Entity\Lpa; use App\Enum\HowAttorneysMakeDecisions; @@ -17,7 +18,6 @@ use DateTimeImmutable; use EventSauce\ObjectHydrator\MapFrom; use EventSauce\ObjectHydrator\PropertyCasters\CastListToType; -use App\Entity\Sirius\Casters\CastToSiriusLifeSustainingTreatment; use Exception; class SiriusLpa extends Lpa implements FindActorInLpaInterface @@ -37,7 +37,7 @@ public function __construct( ?SiriusLpaDonor $donor, ?bool $hasSeveranceWarning, ?DateTimeImmutable $invalidDate, - #[CastToSiriusLifeSustainingTreatment] + #[CastToLifeSustainingTreatment] ?LifeSustainingTreatment $lifeSustainingTreatment, ?DateTimeImmutable $lpaDonorSignatureDate, ?bool $lpaIsCleansed, diff --git a/service-api/app/src/App/src/Enum/LifeSustainingTreatment.php b/service-api/app/src/App/src/Enum/LifeSustainingTreatment.php index ca8fef8864..d7ee101abf 100644 --- a/service-api/app/src/App/src/Enum/LifeSustainingTreatment.php +++ b/service-api/app/src/App/src/Enum/LifeSustainingTreatment.php @@ -4,19 +4,8 @@ namespace App\Enum; -use InvalidArgumentException; - enum LifeSustainingTreatment: string { case OPTION_A = 'option-a'; case OPTION_B = 'option-b'; - - public static function fromShortName(string $shortName): self - { - return match ($shortName) { - 'Option A' => self::OPTION_A, - 'Option B' => self::OPTION_B, - default => throw new InvalidArgumentException('Invalid shorthand name: ' . $shortName), - }; - } } diff --git a/service-api/app/src/App/src/Enum/LpaType.php b/service-api/app/src/App/src/Enum/LpaType.php index 0a3e2b13b0..9d52d85f24 100644 --- a/service-api/app/src/App/src/Enum/LpaType.php +++ b/service-api/app/src/App/src/Enum/LpaType.php @@ -4,19 +4,8 @@ namespace App\Enum; -use InvalidArgumentException; - enum LpaType: string { case PERSONAL_WELFARE = 'hw'; case PROPERTY_AND_AFFAIRS = 'pfa'; - - public static function fromShortName(string $shortName): self - { - return match ($shortName) { - 'personal-welfare' => self::PERSONAL_WELFARE, - 'property-and-affairs' => self::PROPERTY_AND_AFFAIRS, - default => throw new InvalidArgumentException('Invalid shorthand name: ' . $shortName), - }; - } } diff --git a/service-api/app/test/AppTest/Entity/CanCastToSiriusLifeSustainingTreatmentTest.php b/service-api/app/test/AppTest/Entity/CanCastToSiriusLifeSustainingTreatmentTest.php deleted file mode 100644 index abd9e896b0..0000000000 --- a/service-api/app/test/AppTest/Entity/CanCastToSiriusLifeSustainingTreatmentTest.php +++ /dev/null @@ -1,34 +0,0 @@ -mockHydrator = $this->createMock(ObjectMapper::class); - $this->castToSiriusLifeSustainingTreatment = new CastToSiriusLifeSustainingTreatment(); - } - - #[Test] - public function can_cast_sirius_life_sustaining_treatment(): void - { - $lifeSustainingTreatment = 'Option A'; - - $expectedLifeSustainingTreatment = 'option-a'; - - $result = $this->castToSiriusLifeSustainingTreatment->cast($lifeSustainingTreatment, $this->mockHydrator); - - $this->assertEquals($expectedLifeSustainingTreatment, $result); - } -} diff --git a/service-api/app/test/AppTest/Entity/CanHydrateSiriusToModerniseFormatTest.php b/service-api/app/test/AppTest/Entity/CanHydrateSiriusToModerniseFormatTest.php index 8ab74cc329..e80e7173aa 100644 --- a/service-api/app/test/AppTest/Entity/CanHydrateSiriusToModerniseFormatTest.php +++ b/service-api/app/test/AppTest/Entity/CanHydrateSiriusToModerniseFormatTest.php @@ -75,7 +75,7 @@ public function expectedSiriusLpa(): SiriusLpa caseAttorneyJointly: false, caseAttorneyJointlyAndJointlyAndSeverally: false, caseAttorneyJointlyAndSeverally: true, - caseSubtype: LpaType::fromShortName('personal-welfare'), + caseSubtype: LpaType::PERSONAL_WELFARE, channel: null, dispatchDate: null, donor: new SiriusLpaDonor( diff --git a/service-api/app/test/AppTest/Entity/CastToWhenTheLpaCanBeUsedTest.php b/service-api/app/test/AppTest/Entity/CastToWhenTheLpaCanBeUsedTest.php deleted file mode 100644 index d0b1c02bfa..0000000000 --- a/service-api/app/test/AppTest/Entity/CastToWhenTheLpaCanBeUsedTest.php +++ /dev/null @@ -1,34 +0,0 @@ -mockHydrator = $this->createMock(ObjectMapper::class); - $this->castToWhenTheLpaCanBeUsed = new CastToAttorneyActDecisions(); - } - - #[Test] - public function can_when_lpa_can_be_used(): void - { - $whenTheLpaCanBeUsed = 'singular'; - - $expectedWhenTheLpaCanBeUsed = 'singular'; - - $result = $this->castToWhenTheLpaCanBeUsed->cast($whenTheLpaCanBeUsed, $this->mockHydrator); - - $this->assertEquals($expectedWhenTheLpaCanBeUsed, $result); - } -} diff --git a/service-api/app/test/AppTest/Service/Lpa/CombinedSiriusLpaTest.php b/service-api/app/test/AppTest/Service/Lpa/CombinedSiriusLpaTest.php index ea4891dae0..2c267da9fd 100644 --- a/service-api/app/test/AppTest/Service/Lpa/CombinedSiriusLpaTest.php +++ b/service-api/app/test/AppTest/Service/Lpa/CombinedSiriusLpaTest.php @@ -94,7 +94,7 @@ public function getExpectedLpa(): SiriusLpa ), hasSeveranceWarning: null, invalidDate: null, - lifeSustainingTreatment: LifeSustainingTreatment::fromShortName('Option A'), + lifeSustainingTreatment: LifeSustainingTreatment::OPTION_A, lpaDonorSignatureDate: new DateTimeImmutable('2012-12-12'), lpaIsCleansed: true, onlineLpaId: 'A33718377316', diff --git a/service-api/app/test/AppTest/Service/Lpa/ResolveActor/CombinedLpaHasActorTraitTest.php b/service-api/app/test/AppTest/Service/Lpa/ResolveActor/CombinedLpaHasActorTraitTest.php index 8a0dd55e24..6c3903e055 100644 --- a/service-api/app/test/AppTest/Service/Lpa/ResolveActor/CombinedLpaHasActorTraitTest.php +++ b/service-api/app/test/AppTest/Service/Lpa/ResolveActor/CombinedLpaHasActorTraitTest.php @@ -35,98 +35,98 @@ public function setUp(): void applicationHasRestrictions: false, applicationType: 'Classic', attorneys: [ - new SiriusLpaAttorney( - addressLine1: '9 high street', - addressLine2: '', - addressLine3: '', - country: '', - county: '', - dob: null, - email: '', - firstname: 'A', - id: '345678901', - middlenames: null, - otherNames: null, - postcode: 'DN37 5SH', - surname: 'B', - systemStatus: ActorStatus::ACTIVE, - town: '', - uId: '7345678901', - ), - new SiriusLpaAttorney( - addressLine1: '', - addressLine2: '', - addressLine3: '', - country: '', - county: '', - dob: null, - email: 'XXXXX', - firstname: 'B', - id: '456789012', - middlenames: null, - otherNames: null, - postcode: '', - surname: 'C', - systemStatus: ActorStatus::ACTIVE, - town: '', - uId: '7456789012', - ), - new SiriusLpaAttorney( - addressLine1: '', - addressLine2: '', - addressLine3: '', - country: '', - county: '', - dob: null, - email: 'XXXXX', - firstname: 'C', - id: '567890123', - middlenames: null, - otherNames: null, - postcode: '', - surname: 'D', - systemStatus: ActorStatus::ACTIVE, - town: '', - uId: '7567890123', - ), - ], + new SiriusLpaAttorney( + addressLine1: '9 high street', + addressLine2: '', + addressLine3: '', + country: '', + county: '', + dob: null, + email: '', + firstname: 'A', + id: '345678901', + middlenames: null, + otherNames: null, + postcode: 'DN37 5SH', + surname: 'B', + systemStatus: ActorStatus::ACTIVE, + town: '', + uId: '7345678901', + ), + new SiriusLpaAttorney( + addressLine1: '', + addressLine2: '', + addressLine3: '', + country: '', + county: '', + dob: null, + email: 'XXXXX', + firstname: 'B', + id: '456789012', + middlenames: null, + otherNames: null, + postcode: '', + surname: 'C', + systemStatus: ActorStatus::ACTIVE, + town: '', + uId: '7456789012', + ), + new SiriusLpaAttorney( + addressLine1: '', + addressLine2: '', + addressLine3: '', + country: '', + county: '', + dob: null, + email: 'XXXXX', + firstname: 'C', + id: '567890123', + middlenames: null, + otherNames: null, + postcode: '', + surname: 'D', + systemStatus: ActorStatus::ACTIVE, + town: '', + uId: '7567890123', + ), + ], caseAttorneyJointly: true, caseAttorneyJointlyAndJointlyAndSeverally: false, caseAttorneyJointlyAndSeverally: false, - caseSubtype: LpaType::fromShortName('personal-welfare'), + caseSubtype: LpaType::PERSONAL_WELFARE, channel: null, dispatchDate: null, donor: new SiriusLpaDonor( - addressLine1: '81 Front Street', - addressLine2: 'LACEBY', - addressLine3: '', - country: '', - county: '', - dob: null, - email: 'RachelSanderson@opgtest.com', - firstname: 'Rachel', - id: '123456789', - linked: [ - [ - 'id' => '123456789', - 'uId' => '7123456789', - ], - [ - 'id' => '234567890', - 'uId' => '7234567890', - ], - ], - middlenames: null, - otherNames: null, - postcode: 'DN37 5SH', - surname: 'Sanderson', - systemStatus: null, - town: '', - uId: '7123456789', - ), + addressLine1: '81 Front Street', + addressLine2: 'LACEBY', + addressLine3: '', + country: '', + county: '', + dob: null, + email: 'RachelSanderson@opgtest.com', + firstname: 'Rachel', + id: '123456789', + linked: [ + [ + 'id' => '123456789', + 'uId' => '7123456789', + ], + [ + 'id' => '234567890', + 'uId' => '7234567890', + ], + ], + middlenames: null, + otherNames: null, + postcode: 'DN37 5SH', + surname: 'Sanderson', + systemStatus: null, + town: '', + uId: '7123456789', + ), hasSeveranceWarning: null, invalidDate: null, - lifeSustainingTreatment: LifeSustainingTreatment::fromShortName('Option A'), + lifeSustainingTreatment: LifeSustainingTreatment::OPTION_A, lpaDonorSignatureDate: new DateTimeImmutable('2012-12-12'), lpaIsCleansed: true, onlineLpaId: 'A33718377316', @@ -137,101 +137,101 @@ public function setUp(): void status: 'Registered', statusDate: null, trustCorporations: [ - new SiriusLpaTrustCorporation( - addressLine1: 'Street 1', - addressLine2: 'Street 2', - addressLine3: 'Street 3', - companyName: 'A', - country: 'GB', - county: 'County', - dob: null, - email: null, - firstname: 'trust', - id: '678901234', - middlenames: null, - otherNames: null, - postcode: 'ABC 123', - surname: 'test', - systemStatus: ActorStatus::ACTIVE, - town: 'Town', - uId: '7678901234', - ), - new SiriusLpaTrustCorporation( - addressLine1: 'Street 1', - addressLine2: 'Street 2', - addressLine3: 'Street 3', - companyName: 'B', - country: 'GB', - county: 'County', - dob: null, - email: null, - firstname: 'trust', - id: '789012345', - middlenames: null, - otherNames: null, - postcode: 'ABC 123', - surname: 'test', - systemStatus: ActorStatus::ACTIVE, - town: 'Town', - uId: '7789012345', - ), - ], + new SiriusLpaTrustCorporation( + addressLine1: 'Street 1', + addressLine2: 'Street 2', + addressLine3: 'Street 3', + companyName: 'A', + country: 'GB', + county: 'County', + dob: null, + email: null, + firstname: 'trust', + id: '678901234', + middlenames: null, + otherNames: null, + postcode: 'ABC 123', + surname: 'test', + systemStatus: ActorStatus::ACTIVE, + town: 'Town', + uId: '7678901234', + ), + new SiriusLpaTrustCorporation( + addressLine1: 'Street 1', + addressLine2: 'Street 2', + addressLine3: 'Street 3', + companyName: 'B', + country: 'GB', + county: 'County', + dob: null, + email: null, + firstname: 'trust', + id: '789012345', + middlenames: null, + otherNames: null, + postcode: 'ABC 123', + surname: 'test', + systemStatus: ActorStatus::ACTIVE, + town: 'Town', + uId: '7789012345', + ), + ], uId: '700000000047', whenTheLpaCanBeUsed: null, withdrawnDate: null ); $this->lpaStoreMock = new LpaStore( - attorneys: [ + attorneys: [ new LpaStoreAttorney( - line1: '9 high street', - line2: '', - line3: '', - country: '', - county: '', - dateOfBirth: null, - email: '', - firstNames: 'A', - postcode: 'DN37 5SH', - status: ActorStatus::ACTIVE, - lastName: 'B', - town: '', - uId: '7345678901', + line1: '9 high street', + line2: '', + line3: '', + country: '', + county: '', + dateOfBirth: null, + email: '', + firstNames: 'A', + postcode: 'DN37 5SH', + lastName: 'B', + status: ActorStatus::ACTIVE, + town: '', + uId: '7345678901', ), new LpaStoreAttorney( - line1: '', - line2: '', - line3: '', - country: '', - county: '', - dateOfBirth: null, - email: 'XXXXX', - firstNames: 'B', - postcode: '', - status: ActorStatus::ACTIVE, - lastName: 'C', - town: '', - uId: '7456789012', + line1: '', + line2: '', + line3: '', + country: '', + county: '', + dateOfBirth: null, + email: 'XXXXX', + firstNames: 'B', + postcode: '', + lastName: 'C', + status: ActorStatus::ACTIVE, + town: '', + uId: '7456789012', ), new LpaStoreAttorney( - line1: '', - line2: '', - line3: '', - country: '', - county: '', - dateOfBirth: null, - email: 'XXXXX', - firstNames: 'C', - postcode: '', - status: ActorStatus::ACTIVE, + line1: '', + line2: '', + line3: '', + country: '', + county: '', + dateOfBirth: null, + email: 'XXXXX', + firstNames: 'C', + postcode: '', lastName: 'D', - town: '', - uId: '7567890123', + status: ActorStatus::ACTIVE, + town: '', + uId: '7567890123', ), ], - caseSubtype: LpaType::fromShortName('personal-welfare'), - channel: '', - donor: new LpaStoreDonor( + caseSubtype: LpaType::PERSONAL_WELFARE, + channel: '', + donor: new LpaStoreDonor( line1: '81 Front Street', line2: 'LACEBY', line3: '', @@ -247,47 +247,47 @@ public function setUp(): void uId: '7123456789', ), howAttorneysMakeDecisions: null, - lifeSustainingTreatment: LifeSustainingTreatment::fromShortName('Option A'), - signedAt: new DateTimeImmutable('2019-10-10'), - registrationDate: new DateTimeImmutable('2019-10-10'), - status: 'Registered', - trustCorporations: [ + lifeSustainingTreatment: LifeSustainingTreatment::OPTION_A, + signedAt: new DateTimeImmutable('2019-10-10'), + registrationDate: new DateTimeImmutable('2019-10-10'), + status: 'Registered', + trustCorporations: [ new LpaStoreTrustCorporation( - line1: 'Street 1', - line2: 'Street 2', - line3: 'Street 3', - country: 'GB', - county: 'County', - dateOfBirth: null, - email: null, - firstNames: 'trust', - name: 'A', - postcode: 'ABC 123', - status: ActorStatus::ACTIVE, - lastName: 'test', - town: 'Town', - uId: '7678901234', + line1: 'Street 1', + line2: 'Street 2', + line3: 'Street 3', + country: 'GB', + county: 'County', + dateOfBirth: null, + email: null, + firstNames: 'trust', + name: 'A', + postcode: 'ABC 123', + lastName: 'test', + status: ActorStatus::ACTIVE, + town: 'Town', + uId: '7678901234', ), new LpaStoreTrustCorporation( - line1: 'Street 1', - line2: 'Street 2', - line3: 'Street 3', - country: 'GB', - county: 'County', - dateOfBirth: null, - email: null, - firstNames: 'trust', - name: 'B', - postcode: 'ABC 123', - status: ActorStatus::ACTIVE, - lastName: 'test', - town: 'Town', - uId: '7789012345', + line1: 'Street 1', + line2: 'Street 2', + line3: 'Street 3', + country: 'GB', + county: 'County', + dateOfBirth: null, + email: null, + firstNames: 'trust', + name: 'B', + postcode: 'ABC 123', + lastName: 'test', + status: ActorStatus::ACTIVE, + town: 'Town', + uId: '7789012345', ), ], - uId: '700000000047', - updatedAt: new DateTimeImmutable('2019-10-10'), - whenTheLpaCanBeUsed: WhenTheLpaCanBeUsed::WHEN_CAPACITY_LOST + uId: '700000000047', + updatedAt: new DateTimeImmutable('2019-10-10'), + whenTheLpaCanBeUsed: WhenTheLpaCanBeUsed::WHEN_CAPACITY_LOST ); }