/home/bdqbpbxa/api-uniferx.goodface.com.ua/app/Http/Resources/Pages/AnonymousFeedbackResource.php
<?php

namespace App\Http\Resources\Pages;

use App\Helpers\ResourceHelper;
use App\Http\Resources\Pages\TermsConditions\BlockCollection;
use App\Models\Post;
use App\Models\Product;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

/**
 * @OA\Schema(title="AnonymousFeedbackResource", description="AnonymousFeedback resource",
 *     @OA\Xml(name="AnonymousFeedbackResource")
 * )
 */
class AnonymousFeedbackResource extends JsonResource
{
    /**
     * @OA\Property(property="fs_title", type="string", example=""),
     * @OA\Property(property="fs_background", type="string", example=""),
     * @OA\Property(property="fs_description", type="string", example=""),
     * @OA\Property(property="git_tag", type="string", example=""),
     * @OA\Property(property="git_title", type="string", example=""),
     * @OA\Property(property="git_text", type="string", example=""),
     * @OA\Property(property="git_image", type="string", example=""),
     * @OA\Property(property="cta_tag", type="string", example=""),
     * @OA\Property(property="cta_title", type="string", example=""),
     * @OA\Property(property="cta_image", type="string", example=""),
     * @OA\Property(property="cta_field_sender_title", type="string", example=""),
     * @OA\Property(property="cta_field_sender_options", type="string", example=""),
     * @OA\Property(property="cta_field_subject_title", type="string", example=""),
     * @OA\Property(property="cta_field_subject_placeholder", type="string", example=""),
     * @OA\Property(property="cta_field_message_title", type="string", example=""),
     * @OA\Property(property="cta_field_message_placeholder", type="string", example=""),
     * @OA\Property(property="cta_anonymously_checkbox_text", type="string", example=""),
     * @OA\Property(property="cta_field_country_title", type="string", example=""),
     * @OA\Property(property="cta_field_country_placeholder", type="string", example=""),
     * @OA\Property(property="cta_field_region_title", type="string", example=""),
     * @OA\Property(property="cta_field_region_placeholder", type="string", example=""),
     * @OA\Property(property="cta_field_name_title", type="string", example=""),
     * @OA\Property(property="cta_field_name_placeholder", type="string", example=""),
     * @OA\Property(property="cta_field_phone_title", type="string", example=""),
     * @OA\Property(property="cta_field_phone_placeholder", type="string", example=""),
     * @OA\Property(property="cta_field_email_title", type="string", example=""),
     * @OA\Property(property="cta_field_email_placeholder", type="string", example=""),
     * @OA\Property(property="cta_field_postal_address_title", type="string", example=""),
     * @OA\Property(property="cta_field_postal_address_placeholder", type="string", example=""),
     * @OA\Property(property="cta_policy_text", type="string", example=""),
     * @OA\Property(property="cta_anonymously_policy_text", type="string", example=""),
     * @OA\Property(property="cta_submit_button", type="string", example=""),
     * @OA\Property(property="cta_thanks_image", type="string", example=""),
     * @OA\Property(property="cta_thanks_title", type="string", example=""),
     * @OA\Property(property="cta_thanks_text", type="string", example=""),
     * @OA\Property(property="cta_thanks_social_text", type="string", example=""),
     * @OA\Property(property="cta_thanks_inst_link", type="string", example=""),
     * @OA\Property(property="cta_thanks_facebook_link", type="string", example=""),
     * @OA\Property(property="cta_thanks_youtube_link", type="string", example=""),
     */
    public string|null $name;
    public string|null $language;
    public string|null $country;
    public array|null $data;

    public function __construct($resource, $language, $country)
    {
        parent::__construct($resource);
        $this->name = $resource->name;
        $this->language = $language;
        $this->country = $country;
        $this->data = $resource->data;
    }

    /**
     * Transform the resource into an array.
     *
     * @return array<string, mixed>
     */
    public function toArray(Request $request): array
    {
        return [
            'fs_title' => ResourceHelper::getValue($this->data['first_screen_title'] ?? null, $this->country, $this->language),
            'fs_background' => ResourceHelper::getImage($this->data['fs_title_background'] ?? null),
            'fs_description' => ResourceHelper::getValue($this->data['fs_description'] ?? null, $this->country, $this->language),
            'git_tag' => ResourceHelper::getValue($this->data['git_tag'] ?? null, $this->country, $this->language),
            'git_title' => ResourceHelper::getValue($this->data['git_title'] ?? null, $this->country, $this->language),
            'git_text' => ResourceHelper::getValue($this->data['git_text'] ?? null, $this->country, $this->language),
            'git_image' => ResourceHelper::getImage($this->data['git_image'] ?? null),
            'cta_tag' => ResourceHelper::getValue($this->data['cta_tag'] ?? null, $this->country, $this->language),
            'cta_title' => ResourceHelper::getValue($this->data['cta_title'] ?? null, $this->country, $this->language),
            'cta_image' => ResourceHelper::getImage($this->data['cta_image'] ?? null),
            'cta_field_sender_title' => ResourceHelper::getValue($this->data['cta_field_sender_title'] ?? null, $this->country, $this->language),
            'cta_field_sender_options' => ResourceHelper::getValue($this->data['cta_field_sender_options'] ?? null, $this->country, $this->language),
            'cta_field_subject_title' => ResourceHelper::getValue($this->data['cta_field_subject_title'] ?? null, $this->country, $this->language),
            'cta_field_subject_placeholder' => ResourceHelper::getValue($this->data['cta_field_subject_placeholder'] ?? null, $this->country, $this->language),
            'cta_field_message_title' => ResourceHelper::getValue($this->data['cta_field_message_title'] ?? null, $this->country, $this->language),
            'cta_field_message_placeholder' => ResourceHelper::getValue($this->data['cta_field_message_placeholder'] ?? null, $this->country, $this->language),
            'cta_anonymously_checkbox_text' => ResourceHelper::getValue($this->data['cta_anonymously_checkbox_text'] ?? null, $this->country, $this->language),
            'cta_field_country_title' => ResourceHelper::getValue($this->data['cta_field_country_title'] ?? null, $this->country, $this->language),
            'cta_field_country_placeholder' => ResourceHelper::getValue($this->data['cta_field_country_placeholder'] ?? null, $this->country, $this->language),
            'cta_field_region_title' => ResourceHelper::getValue($this->data['cta_field_region_title'] ?? null, $this->country, $this->language),
            'cta_field_region_placeholder' => ResourceHelper::getValue($this->data['cta_field_region_placeholder'] ?? null, $this->country, $this->language),
            'cta_field_name_title' => ResourceHelper::getValue($this->data['cta_field_name_title'] ?? null, $this->country, $this->language),
            'cta_field_name_placeholder' => ResourceHelper::getValue($this->data['cta_field_name_placeholder'] ?? null, $this->country, $this->language),
            'cta_field_phone_title' => ResourceHelper::getValue($this->data['cta_field_phone_title'] ?? null, $this->country, $this->language),
            'cta_field_phone_placeholder' => ResourceHelper::getValue($this->data['cta_field_phone_placeholder'] ?? null, $this->country, $this->language),
            'cta_field_email_title' => ResourceHelper::getValue($this->data['cta_field_email_title'] ?? null, $this->country, $this->language),
            'cta_field_email_placeholder' => ResourceHelper::getValue($this->data['cta_field_email_placeholder'] ?? null, $this->country, $this->language),
            'cta_field_postal_address_title' => ResourceHelper::getValue($this->data['cta_field_postal_address_title'] ?? null, $this->country, $this->language),
            'cta_field_postal_address_placeholder' => ResourceHelper::getValue($this->data['cta_field_postal_address_placeholder'] ?? null, $this->country, $this->language),
            'cta_policy_text' => ResourceHelper::getValue($this->data['cta_policy_text'] ?? null, $this->country, $this->language),
            'cta_anonymously_policy_text' => ResourceHelper::getValue($this->data['cta_anonymously_policy_text'] ?? null, $this->country, $this->language),
            'cta_submit_button' => ResourceHelper::getValue($this->data['cta_submit_button'] ?? null, $this->country, $this->language),
            'cta_thanks_image' => ResourceHelper::getImage($this->data['cta_thanks_image'] ?? null),
            'cta_thanks_title' => ResourceHelper::getValue($this->data['cta_thanks_title'] ?? null, $this->country, $this->language),
            'cta_thanks_text' => ResourceHelper::getValue($this->data['cta_thanks_text'] ?? null, $this->country, $this->language),
            'cta_thanks_social_text' => ResourceHelper::getValue($this->data['cta_thanks_social_text'] ?? null, $this->country, $this->language),
            'cta_thanks_inst_link' => ResourceHelper::getValue($this->data['cta_thanks_inst_link'] ?? null, $this->country, $this->language),
            'cta_thanks_facebook_link' => ResourceHelper::getValue($this->data['cta_thanks_facebook_link'] ?? null, $this->country, $this->language),
            'cta_thanks_youtube_link' => ResourceHelper::getValue($this->data['cta_thanks_youtube_link'] ?? null, $this->country, $this->language),
        ];
    }

}