forked from apoloz/alfa-bank-sdk
42 lines
2.1 KiB
PHP
42 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
/*
|
|
// MODULE_CONTRACT: Defines the data structure for the request payload to perform an action on a deal step.
|
|
// RESPONSIBILITY: To hold and validate all necessary information for actions such as completing or canceling a step within a deal.
|
|
// INPUTS: Deal ID, action type, signatures, and optional step ID and description.
|
|
// OUTPUTS: A structured, type-safe object for the `ManageStepRequest` payload.
|
|
// LINKS: Requests/NominalAccounts/Deals/Steps/ManageStepRequest.php
|
|
*/
|
|
|
|
namespace Apoloz\AlfaBank\Data\NominalAccounts\Deals\Steps;
|
|
|
|
// <SECTION name="module_imports" intent="Import necessary DTOs and Spatie Laravel Data components.">
|
|
// <BELIEF_STATE "This DTO requires `DigestSignatureData` as a collection for security, utilizing `DataCollectionOf` for type safety.">
|
|
use Apoloz\AlfaBank\Data\NominalAccounts\Payouts\DigestSignatureData;
|
|
use Apoloz\AlfaBank\Traits\SignableData;
|
|
use Spatie\LaravelData\Attributes\DataCollectionOf;
|
|
use Spatie\LaravelData\Data;
|
|
use Spatie\LaravelData\DataCollection;
|
|
|
|
// </SECTION>
|
|
|
|
// <SECTION name="class_definition" intent="Define a DTO for performing an action on a deal step.">
|
|
// <BELIEF_STATE "This DTO encapsulates the data required to transition a deal step to a new state (e.g., COMPLETE, CANCEL). It handles the action type, identifiers, and necessary signatures.">
|
|
class StepActionRequestData extends Data
|
|
{
|
|
use SignableData;
|
|
|
|
// <SECTION name="constructor_properties" intent="Define the properties of the step action request.">
|
|
// <BELIEF_STATE "The constructor includes mandatory fields like `dealId`, `action` (e.g., 'COMPLETE', 'CANCEL'), and `digestSignatures`. Optional fields like `stepId` (if targeting a specific step within the deal) and `description` provide flexibility and context for the action.">
|
|
public function __construct(
|
|
public string $dealId,
|
|
public string $action,
|
|
#[DataCollectionOf(DigestSignatureData::class)]
|
|
public ?DataCollection $digestSignatures = null,
|
|
public ?string $stepId = null,
|
|
public ?string $description = null,
|
|
) {}
|
|
// </SECTION>
|
|
}
|