<?php
namespace App\Http\Resources;

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

class TenantResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return [
            'uuid' => $this->uuid,
            'business_code' => $this->business_code,
            'business_name' => $this->business_name,
            'business_email' => $this->business_email,
            'business_phone' => $this->business_phone,
            'business_type' => $this->business_type,
            'server_logo_url' => $this->server_logo_url,
            'subdomain' => $this->subdomain,
            'online_store_name' => $this->online_store_name,
            'online_open_time' => $this->online_open_time,
            'online_close_time' => $this->online_close_time,
            'is_close_service' => (bool) $this->is_close_service,
            'preparation_time_minutes' => (int) $this->preparation_time_minutes,
            'order_interval_minutes' => (int) $this->order_interval_minutes,
            'allow_cod' => (bool) $this->allow_cod,
            'max_delivery_radius_km' => (float) $this->max_delivery_radius_km,
            'delivery_fee_type' => $this->delivery_fee_type,
            'delivery_flat_fee' => (float) $this->delivery_flat_fee,
            'delivery_fee_per_km' => (float) $this->delivery_fee_per_km,
            'delivery_base_fee' => (float) $this->delivery_base_fee,
            'review_display_type' => $this->review_display_type,
            'review_display_policy' => $this->review_display_policy,
            'subscription_level' => $this->subscription_level,
            'limit_outlet' => (int) $this->limit_outlet,
            'subscription_expires_at' => $this->subscription_expires_at?->toIso8601String(),
            'created_at' => $this->created_at?->toIso8601String(),
            'updated_at' => $this->updated_at?->toIso8601String(),
        ];
    }
}
