<?php

namespace Database\Seeders\RenderService;

use App\Models\ContractTemplate;

use Illuminate\Database\Seeder;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\DB;
use Carbon\Carbon;

class RenderServiceContractsTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $contract_template = ContractTemplate::find(3);

        DB::table('contracts')->insert([
            [
                'id' => 3,
                'user_id' => $contract_template->user_id,
                'contract_template_id' => $contract_template->id,
                'name' => $contract_template->name,
                'in_time_contract_template' => json_encode($contract_template),
                'status' => 1,
                'completed_at' => null,
                'failed_at' => null,
                'start_at' => Carbon::now(),
                'end_at' => Carbon::now()->addDays($contract_template->complete_day_range),
                'created_at' => date('Y-m-d H:i:s'),
                'updated_at' => date('Y-m-d H:i:s')
            ]
        ]);
    }
}