<?php

namespace App\Models;

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

class PartnerShow extends Model
{
    use HasFactory;

    /**
     * The attributes that are mass assignable.
     *
     * @var list<string>
     */
    protected $fillable = [
        'partner_id',
        'showId',
        'title',
        'description',
        'lineup',
        'seitansai',
        'graduation',
        'start_time',
        'type',
        'price',
        'banner_link',
        'is_promo',
        'promo_price',
        'is_active',
        'is_live',
        'is_replay',
        'streamer_live',
        'slug_live',
        'url_live',
        'url_replay',
        'type_live',
    ];

    /**
     * Get the attributes that should be cast.
     *
     * @return array<string, string>
     */
    protected function casts(): array
    {
        return [
            'lineup' => 'array',
            'seitansai' => 'array',
            'graduation' => 'array',
            'start_time' => 'integer',
            'price' => 'decimal:2',
            'is_promo' => 'boolean',
            'promo_price' => 'decimal:2',
            'is_active' => 'boolean',
            'is_live' => 'boolean',
            'is_replay' => 'boolean',
        ];
    }

    /**
     * Get the partner (user) that owns this show.
     */
    public function partner(): BelongsTo
    {
        return $this->belongsTo(User::class, 'partner_id');
    }
}

