<?php

namespace App\Domains\Tenant\Resources;

use App\Domains\Tenant\Enums\CartEditingPolicy;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

/** @mixin CartEditingPolicy */
class CartEditingPolicyResource extends JsonResource
{
    /** @return array<string, bool|string> */
    public function toArray(Request $request): array
    {
        return [
            'code' => $this->resource->value,
            'allow_modify' => $this->resource->allowsModification(),
            'allow_delete' => $this->resource->allowsRemoval(),
            'allow_update_quantity' => $this->resource->allowsQuantityChanges(),
            'allow_update_variant' => $this->resource->allowsVariantChanges(),
        ];
    }
}
