<?php

namespace App\Http\Resources\Customer;

use App\Http\Resources\CustomerReferenceResource;
use App\Http\Resources\MethodContactResource;
use App\Http\Resources\Opportunity\ActivityResource;
use App\Http\Resources\Opportunity\Procedure\ProcedureResource;
use App\Http\Resources\Realty\PropertyResource;
use App\Http\Resources\SourceResource;
use App\Http\Resources\Stage\StageResource;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class OpportunityPerfilResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @return array<string, mixed>
     */
    public function toArray(Request $request): array
    {
        return [
            'id' => $this->id,
            'start_date' => $this->start_date,
            'end_date' => $this->end_date,
            'description' => $this->description,

            'source_id' => $this->source_id,
            'source'=> new SourceResource($this->source),
            'type_customer' => $this->type_customer,

            'contact_method_id' => $this->contact_method_id,
            'contact_method'=> new MethodContactResource($this->contact_method),

            'customer_references_id' => $this->customer_references_id,
            'customer_references'=> new CustomerReferenceResource($this->customer_reference),
            'stage_id' => $this->stage_id,
            'stage'=> new StageResource($this->stage),
            'property_id' => $this->property_id,
            'property'=>new PropertyResource( $this->property),
            'procedure'=> ProcedureResource::collection($this->procedures),
        ];
    }
}
