<?php

namespace App\Models;

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

class Customer extends Model
{
    use HasFactory;

    // Konstanta untuk jenis member
    public const MEMBER_TYPE_UMUM = 'umum';
    public const MEMBER_TYPE_STUDIO = 'studio';

    public const MEMBER_TYPES = [
    'umum' => 'Umum',
    'studio' => 'Percetakan',
    ];

    protected $fillable = [
        'name',
        'member_type',
        'phone',
        'email',
        'address',
    ];

    /**
     * Get the label for member type
     */
    public function getMemberTypeLabelAttribute(): string
    {
        return self::MEMBER_TYPES[$this->member_type] ?? 'Umum';
    }

    public function orders()
    {
        return $this->hasMany(Order::class);
    }
}
