<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class CustomerClubReward extends Model
{
    protected $fillable = [
        'user_id',
        'activity',
        'title',
        'amount',
        'meta',
    ];

    protected $casts = [
        'amount' => 'integer',
        'meta'   => 'array',
    ];

    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class);
    }

    public function shamsiDate(): string
    {
        return Order::toJalaliString($this->created_at);
    }

    public function activityLabel(): string
    {
        return match ($this->activity) {
            'spin_wheel' => 'گردونه شانس',
            default      => $this->activity,
        };
    }
}
