<?php

namespace App\Modules\SuperAdmin\Resources;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class AdminSubscriptionResource extends JsonResource
{
    /**
     * @return array<string, mixed>
     */
    public function toArray(Request $request): array
    {
        return [
            'id' => $this->id,
            'billing_cycle' => $this->billing_cycle,
            'status' => $this->status,
            'starts_at' => $this->starts_at,
            'trial_ends_at' => $this->trial_ends_at,
            'renews_at' => $this->renews_at,
            'ends_at' => $this->ends_at,
            'company' => [
                'id' => $this->company->id,
                'name' => $this->company->name,
                'slug' => $this->company->slug,
            ],
            'plan' => [
                'id' => $this->plan->id,
                'name' => $this->plan->name,
                'slug' => $this->plan->slug,
            ],
        ];
    }
}
