52 lines
1.4 KiB
PHP
52 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Upload\Contracts;
|
|
|
|
use Illuminate\Http\UploadedFile;
|
|
|
|
interface UploadDraftServiceInterface
|
|
{
|
|
/**
|
|
* Create a new draft and return identifying info.
|
|
*
|
|
* @param array $attributes
|
|
* @return array ['id' => string, 'path' => string, 'meta' => array]
|
|
*/
|
|
public function createDraft(array $attributes = []): array;
|
|
|
|
/**
|
|
* Store the main uploaded file for the draft.
|
|
*
|
|
* @param string $draftId
|
|
* @param UploadedFile $file
|
|
* @return array Metadata about stored file (path, size, mime, hash)
|
|
*/
|
|
public function storeMainFile(string $draftId, UploadedFile $file): array;
|
|
|
|
/**
|
|
* Store a screenshot/preview image for the draft.
|
|
*
|
|
* @param string $draftId
|
|
* @param UploadedFile $file
|
|
* @return array Metadata about stored screenshot
|
|
*/
|
|
public function storeScreenshot(string $draftId, UploadedFile $file): array;
|
|
|
|
/**
|
|
* Calculate a content hash for a local file path or storage path.
|
|
*
|
|
* @param string $filePath
|
|
* @return string
|
|
*/
|
|
public function calculateHash(string $filePath): string;
|
|
|
|
/**
|
|
* Set an expiration timestamp for the draft.
|
|
*
|
|
* @param string $draftId
|
|
* @param \Carbon\Carbon|null $expiresAt
|
|
* @return bool
|
|
*/
|
|
public function setExpiration(string $draftId, ?\Carbon\Carbon $expiresAt = null): bool;
|
|
}
|