<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;use Illuminate\Database\Eloquent\MassPrunable;use Illuminate\Database\Eloquent\Builder;
class IdempotencyRecord extends Model
{
    use MassPrunable;
    public $timestamps=false;
    protected $fillable=['user_id','key','endpoint','request_hash','response_status','response_body_encrypted','resource_type','resource_id','created_at','expires_at'];
    protected $hidden=['response_body_encrypted','request_hash'];
    public function prunable():Builder{return static::where('expires_at','<',now());}
    protected function casts():array{return ['response_status'=>'integer','created_at'=>'datetime','expires_at'=>'datetime'];}
}
