Last active
December 6, 2025 21:31
-
-
Save trikitrok/3964c37c208e41d11d69fc0b0c82adee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class OpeningResult | |
| { | |
| private readonly string? _failureDescription; | |
| private readonly ReferenceInCompany? _referenceInCompany; | |
| private readonly ClaimId _claimId; | |
| private OpeningResult(ReferenceInCompany? referenceInCompany, ClaimId claimId, string? failureDescription) | |
| { | |
| _failureDescription = failureDescription; | |
| _claimId = claimId; | |
| _referenceInCompany = referenceInCompany; | |
| } | |
| public static OpeningResult Success(ClaimId claimId, ReferenceInCompany referenceInCompany) | |
| { | |
| return new OpeningResult(refenceInCompany, claimId, null); | |
| } | |
| public static OpeningResult Failure(ClaimId claimId, string description) | |
| { | |
| return new OpeningResult(null, claimId, description); | |
| } | |
| public void Notify(ClaimCompanyId claimCompanyId, OpeningListener openingListener) | |
| { | |
| if (IsFailure()) | |
| { | |
| openingListener.OpeningFailed( | |
| new OpeningFailure(_failureDescription, _claimId, claimCompanyId) | |
| ); | |
| } | |
| else | |
| { | |
| openingListener.OpeningSucceeded( | |
| new OpeningSuccess(_referenceInCompany, _claimId, claimCompanyId) | |
| ); | |
| } | |
| } | |
| private bool IsFailure() | |
| { | |
| return _referenceInCompany == null; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment