<?php

namespace App\Jobs;

use App\Services\OwnerPriceOperationService;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

class HandlePastBill implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $arr;
    /**
     * Create a new job instance.
     *
     * @param array $arr
     *
     * @return void
     */
    public function __construct(array $arr)
    {
        $this->arr = $arr;
    }

    /**
     * Execute the job.
     *
     * @param OwnerPriceOperationService $service
     *
     * @return void
     */
    public function handle(OwnerPriceOperationService $service)
    {
        list($rule,$owner,$discountIndex,$pivot) = $this->arr;
        $service->handlePastBill($rule,$owner,$discountIndex,$pivot);
    }
}
