forked from apoloz/alfa-bank-sdk
33 lines
1.6 KiB
PHP
33 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
/*
|
|
// MODULE_CONTRACT: Defines the data structure for the response of a deal validation request.
|
|
// RESPONSIBILITY: To hold and type-safely represent the outcome of checking a deal's validity.
|
|
// INPUTS: Raw JSON object from the API response.
|
|
// OUTPUTS: A structured object containing deal validation status.
|
|
// LINKS: Requests/NominalAccounts/Deals/ValidateDealRequest.php
|
|
*/
|
|
|
|
namespace Apoloz\AlfaBank\Data\NominalAccounts\Deals;
|
|
|
|
// <SECTION name="module_imports" intent="Import the base Spatie Laravel Data class.">
|
|
// <BELIEF_STATE "Extending `Spatie\LaravelData\Data` enables automatic casting from JSON and provides other DTO benefits.">
|
|
use Spatie\LaravelData\Data;
|
|
|
|
// </SECTION>
|
|
|
|
// <SECTION name="class_definition" intent="Define a DTO for the response of a deal validation.">
|
|
// <BELIEF_STATE "This DTO provides a clear, type-safe contract for understanding whether a deal is considered valid for further operations, including an optional description for validation failures.">
|
|
class ValidateDealResponseData extends Data
|
|
{
|
|
// <SECTION name="constructor_properties" intent="Define the properties of a deal validation response.">
|
|
// <BELIEF_STATE "The constructor includes the `dealId` for context, a boolean `isValid` to indicate the validation outcome, and an optional `description` to provide details for invalid deals.">
|
|
public function __construct(
|
|
public string $dealId,
|
|
public bool $isValid,
|
|
public ?array $description = null, // Can be a string or array of error messages
|
|
) {}
|
|
// </SECTION>
|
|
}
|