<?php
namespace App\Models;

class DealCommission
{
    public $id;
    public $deal_didar_id;
    public $transaction_id;
    public $deal_payment_id;
    public $deposit_date;
    public $billing_month;
    public $salesperson_user_id;
    public $product_id;
    public $commission_rule_id;
    public $commission_rule_assignment_id;
    public $ncr_amount;
    public $applied_rate_percent;
    public $calculated_commission;
    public $payout_cycle_id;
    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 $deleted_by_user_id;
    public $notes;
    public $created_at;
    public $updated_at;
    public $deleted_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);
    }
}
