<?php

namespace Modules\Subscription\Resources\Api;

use Illuminate\Http\Resources\Json\JsonResource;
use Modules\Package\Resources\Api\PackageResource;

class SubscriptionResource extends JsonResource
{

    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => (int) $this->id,
            'remain_points' => (double) $this->remain_points,
            'total' => (double) $this->total,
            'points' => (double) $this->points,
            'package' => new PackageResource($this->package),
            'date'=>$this->created_at
        ];
    }

}
