<?php

namespace App\Models\Users;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class BotApiResponse extends Model
{
    protected $table = 'botmsg_api_response';
    use HasFactory;
    public static $API_USERNAME = 'wa.api';
    public static $API_PASSWORD = 'A7b!iw_ert24@^#^4f*r4(';


    public static function saveApiResponse($fk_bot_info, $visitor_id, $bot_msg_id, $api_status, $api_message, $api_response)
    {
        $submit_data = array(
            'fk_bot_info' => $fk_bot_info,
            'fk_visitor_id' => $visitor_id,
            'bot_msg_id' => $bot_msg_id,
            'api_status' => $api_status,
            'api_message' => $api_message,
            'api_response' => $api_response,
            'status' => 1,
            'created_at' => NOW()
        );
        $save = DB::table('botmsg_api_response')->insert($submit_data);
    }
}
