/home/bdqbpbxa/api-uniferx.goodface.com.ua/app/Http/Resources/Pages/Career/ImageResource.php
<?php
namespace App\Http\Resources\Pages\Career;

use App\Helpers\ResourceHelper;
use App\Http\Resources\Pages\Contacts\CountryCollection;
use App\Http\Resources\Pages\Contacts\RegionCollection;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Arr;

/**
 * @OA\Schema(title="CropTrialsResource",description="CropTrials resource",
 *     @OA\Xml(name="CropTrialsResource")
 * )
 */
class ImageResource extends JsonResource
{

    /**
     * @OA\Property(property="title", type="string", example="Kalyna farming enterprise  Ternopil region, 2023"),
     * @OA\Property(property="file", type="string", example="https://uniferx-backend.test/storage/crops/trials/X2YZbZ7anmN5W3QdUn3iJEgacNxdXNKP1KTQakt8.txt"),
     */
    public string|null $language;
    public string|null $country;
    public array|null $data;

    public function language($value): static
    {
        $this->language = $value;
        return $this;
    }

    public function country($value): static
    {
        $this->country = $value;
        return $this;
    }

    public function __construct($resource)
    {
        parent::__construct($resource);
        $this->resource = $resource;
    }



    public function toArray(Request $request)
    {
        return ResourceHelper::getImage($this->resource ?? null);
    }

    public static function collection($resource): ImageCollection
    {
        return new ImageCollection($resource);
    }
}