33 lines
1.5 KiB
PHP
33 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
/*
|
|
// MODULE_CONTRACT: Defines the data structure for a single file link, typically for upload or download.
|
|
// RESPONSIBILITY: To hold and type-safely represent the URL, HTTP method, and optional detached signature link for file operations.
|
|
// INPUTS: Raw JSON object or internal input.
|
|
// OUTPUTS: A structured object containing file link details.
|
|
// LINKS: DownloadFileResponseData.php, UploadFileResponseData.php
|
|
*/
|
|
|
|
namespace Apoloz\AlfaBank\Data\FileExchange;
|
|
|
|
// <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 file link details.">
|
|
// <BELIEF_STATE "This DTO provides a clear, type-safe contract for representing file access points, crucial for orchestrating multi-step file exchange processes.">
|
|
class FileLinkData extends Data
|
|
{
|
|
// <SECTION name="constructor_properties" intent="Define the properties of a file link.">
|
|
// <BELIEF_STATE "The constructor includes the `url` for access, the `method` (e.g., GET, PUT) to use with the URL, and an optional `detachedSignatureLink` for cases where a signature file might be fetched separately.">
|
|
public function __construct(
|
|
public string $url,
|
|
public string $method,
|
|
public ?FileLinkData $detachedSignatureLink = null, // Nested link for signatures
|
|
) {}
|
|
// </SECTION>
|
|
}
|