48 lines
2.7 KiB
PHP
48 lines
2.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
/*
|
|
// MODULE_CONTRACT: Defines the data structure for the request payload to perform an action on a deal contractor.
|
|
// RESPONSIBILITY: To hold and validate all necessary information for actions such as adding or managing contractors within a deal step.
|
|
// INPUTS: Action type, deal ID, step ID, beneficiary ID, signatures, and optional financial details.
|
|
// OUTPUTS: A structured, type-safe object for the `ManageContractorRequest` payload.
|
|
// LINKS: Requests/NominalAccounts/Deals/Steps/ManageContractorRequest.php
|
|
*/
|
|
|
|
namespace Apoloz\AlfaBank\Data\NominalAccounts\Deals\Steps;
|
|
|
|
// <SECTION name="module_imports" intent="Import necessary DTOs and Spatie Laravel Data components for complex nested data structures.">
|
|
// <BELIEF_STATE "This DTO orchestrates several other DTOs and collections (`DigestSignatureData`, `ContractorAmountData`), requiring `DataCollectionOf` for typed arrays.">
|
|
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 contractor.">
|
|
// <BELIEF_STATE "This DTO provides a robust contract for managing contractors within deal steps. It ensures that critical financial and security-related data is strictly typed and correctly structured for actions like adding funds or changing status.">
|
|
class ContractorActionRequestData extends Data
|
|
{
|
|
use SignableData;
|
|
|
|
// <SECTION name="constructor_properties" intent="Define all properties for the contractor action request.">
|
|
// <BELIEF_STATE "The constructor includes mandatory fields like `action`, `dealId`, `stepId`, `beneficiaryId`, and `digestSignatures`. Optional fields like `amount`, `purpose`, `amounts` (for detailed distribution), `keepOnNominalAccount`, and `requisiteId` provide flexibility for various contractor management scenarios.">
|
|
public function __construct(
|
|
public string $action, // e.g., ADD_AMOUNT, REMOVE_AMOUNT, SET_REQUISITE
|
|
public string $dealId,
|
|
public string $stepId,
|
|
public string $beneficiaryId,
|
|
#[DataCollectionOf(DigestSignatureData::class)]
|
|
public ?DataCollection $digestSignatures = null,
|
|
public ?string $amount = null,
|
|
public ?string $purpose = null,
|
|
#[DataCollectionOf(ContractorAmountData::class)]
|
|
public ?DataCollection $amounts = null, // For detailed amount distribution
|
|
public ?bool $keepOnNominalAccount = null,
|
|
public ?string $requisiteId = null,
|
|
) {}
|
|
// </SECTION>
|
|
}
|