<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * 定期契約モデル - regular_contractテーブル（正式モデル）
 * 旧UsingStatusContractの責務を置き換え
 */
class RegularContract extends Model
{
    protected $table = 'regular_contract';
    protected $primaryKey = 'contract_id';
    public $timestamps = true;

    public const CREATED_AT = 'created_at';
    public const UPDATED_AT = 'updated_at';

    protected $fillable = [
        'contract_qr_id',
        'user_id',
        'user_categoryid',
        'reserve_id',
        'park_id',
        'price_parkplaceid',
        'user_securitynum',
        'reserve_date',
        'contract_reserve',
        'contract_created_at',
        'contract_updated_at',
        'contract_cancelday',
        'contract_reduction',
        'contract_periods',
        'contract_periode',
        'enable_months',
        'printable_date',
        'contract_taxid',
        'billing_amount',
        'contract_payment_day',
        'contract_money',
        'refunds',
        'refunds_comment',
        'repayment_at',
        'contact_guid',
        'contact_shop_code',
        'contract_cvs_class',
        'contract_flag',
        'settlement_transaction_id',
        'contract_seal_issue',
        'seal_reissue_request',
        'update_flag',
        'contract_permission',
        'contract_cancel_flag',
        '800m_flag',
        'tag_qr_flag',
        'tag_change_flag',
        'park_position',
        'ope_id',
        'contract_manual',
        'contract_notice',
        'contract_payment_number',
    ];

    /**
     * 料金設定
     */
    public function price()
    {
        return $this->belongsTo(PriceA::class, 'price_parkplaceid', 'price_parkplaceid');
    }
}


