<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class CouponResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'user' => $this->user ? UserResource::make($this->user) : null,
            'code' => $this->code,
            'available_users' => $this->available_users,
            'used_count' => $this->used_count,
            'discount_type' => $this->discount_type,
            'discount_amount' => $this->discount_amount,
            'marketer_percentage' => $this->marketer_percentage,
            'start_date' => $this->start_date,
            'end_date' => $this->end_date,
            'service_type' => $this->service_type,
            'status' => $this->status,
        ];
    }
}
