<?php

namespace App\Jobs\GrowingIO;

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

class ClickWeixinReportJob extends BaseReportJob implements ShouldQueue
{
    use Dispatchable;
    use InteractsWithQueue;
    use Queueable;
    use SerializesModels;


    protected $uid;
    protected $from;
    protected $copy_uid;
    protected $copy_type;
    protected $device;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($uid, $attribute)
    {
        $this->uid = $uid;
        $this->from = $attribute['from'];
        $this->copy_uid = $attribute['copy_uid'];
        $this->copy_type = $attribute['copy_type'];
        $this->device = $attribute['device'];
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function doHandle()
    {
        $this->doReport(self::CLICK_WEIXIN, $this->uid, [
            'from' => $this->from,
            'related_id' => $this->copy_uid,
            'type' => $this->copy_type,
            'device' => $this->device
        ]);
    }
}
