<?php
namespace App\Models;

class DealCommission
{
    public $id;
    public $deal_didar_id;
    public $salesperson_user_id;
    public $product_id;
    public $commission_rule_id;
    public $ncr_amount;
    public $applied_rate_percent;
    public $kpi_multiplier;
    public $calculated_commission;
    public $status;
    public $manager_reviewed_by_user_id;
    public $manager_reviewed_at;
    public $finance_reviewed_by_user_id;
    public $finance_reviewed_at;
    public $settled_by_user_id;
    public $settled_at;
    public $notes;
    public $created_at;
    public $updated_at;

    // Joins
    public $salesperson_name;
    public $product_name;
    public $manager_name;
    public $finance_name;
    public $settled_by_name;

    public function __construct(array $data = [])
    {
        foreach ($data as $key => $value) {
            if (property_exists($this, $key)) {
                $this->$key = $value;
            }
        }
    }

    public function toArray(): array
    {
        return get_object_vars($this);
    }
}
