<?php
namespace App\Models;

/**
 * User Model
 */
class User
{
    public $id;
    public $didar_user_id;
    public $email;
    public $first_name;
    public $last_name;
    public $display_name;
    public $username;
    public $password;
    public $role;
    public $is_active;
    public $api_key;
    public $last_sync;
    public $created_at;

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

    public function toArray()
    {
        return [
            'id' => $this->id,
            'didar_user_id' => $this->didar_user_id,
            'email' => $this->email,
            'first_name' => $this->first_name,
            'last_name' => $this->last_name,
            'display_name' => $this->display_name,
            'username' => $this->username,
            'role' => $this->role,
            'is_active' => $this->is_active,
            'last_sync' => $this->last_sync,
            'created_at' => $this->created_at,
        ];
    }
}

