<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class AffiliateResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'code' => $this->code,
            'campaign_name' => $this->campaign_name,
            'campaign_description' => $this->campaign_description,
            'is_active' => (bool) $this->is_active,
            'created_by' => $this->created_by,
            'clicks_count' => $this->clicks_count,
            'registrations_count' => $this->registrations_count,
            'orders_count' => $this->orders_count,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
        ];
    }
}

