<?php

namespace App\Support\Marketplace;

use Spatie\LaravelData\Data;

class MarketplaceFeeRule extends Data
{
    public function __construct(
        public string $base = 'per_transaksi',
        public string $type = 'persentase',
        public float $value = 0.0,
    ) {}

    public static function defaultPercent(float $value): static
    {
        return new static(
            base: 'per_transaksi',
            type: 'persentase',
            value: $value,
        );
    }

    public function toArray(): array
    {
        return [
            'base' => $this->base,
            'type' => $this->type,
            'value' => (float) $this->value,
        ];
    }
}
