<?php
require_once 'vendor/autoload.php';
include_once 'utils.php';

class User
{
    public $id;
    public $username;
    public $first_name;
    public $last_name;
    public $organization;
    public $user_hash;
    public $password;
    public $street;
    public $zip;
    public $city;
    public $country;
    public $email;
    public $phone;
    public bool $eula_signed;
    public bool $privacy_policy_signed;
    public bool $author;
    public $accepted_paper_id;
    public bool $participation_confirmed;
    public $participation_confirmed_at;
    public bool $student;
    public bool $conference_dinner;
    public $registered_at;
    public bool $earlybird_registration;
    public float $total_due;
    public $invoice;

    function __construct()
    {
        $this->id = "";
        $this->username = "";
        $this->first_name = "";
        $this->last_name = "";
        $this->email = "";
        $this->organization = "";
        $this->user_hash = "";
        $this->password = "";
        $this->city = "";
        $this->country = "";
        $this->zip = "";
        $this->street = "";
        $this->phone = "";
        $this->eula_signed = false;
        $this->privacy_policy_signed = false;
        $this->author = false;
        $this->accepted_paper_id = "";
        $this->participation_confirmed = false;
        $this->participation_confirmed_at = "";
        $this->student = false;
        $this->conference_dinner = false;
        $this->registered_at = date("Y-m-d H:i:s") . "UTC";
        $this->earlybird_registration = false;
        $this->total_due = 0.0;
        $this->invoice = "";
    }

    function __construct1(object $data)
    {
        foreach ($data as $key => $value) {
            if (array_key_exists($key, (array) $this))
                $this->{$key} = $value;
        }
        if (isset($data->password)) $this->set_password($data->password);
    }

    function init_from_object(object $data)
    {
        foreach ($data as $key => $value) {
            if (array_key_exists($key, (array) $this))
                $this->{$key} = $value;
        }
        if (isset($data->password)) $this->set_password($data->password);
    }

    function init_from_array(array $data)
    {
        foreach ($data as $key => $value) {
            if (array_key_exists($key, (array) $this)) {
                if (is_bool(gettype($this->{$key})) && is_string($value))
                    $this->{$key} = !empty($value);
                else
                    $this->{$key} = $value;
            }
        }
        if (!empty($data["password"])) $this->set_password($data["password"]);
    }


    function set_password(string $password)
    {
        include 'config.php';
        if ($CONFERENCE_REGISTRATION) {
            $this->password = generateRandomString(32);
            # $this->user_hash = "{SHA}" .  base64_encode(sha1($password, true));
        } else {
            if ($ENCRYPT_PASSWORDS) {
                $this->user_hash = "{crypt}" . crypt($password, '$6$' . generateSalt(10) . '$');
                # $this->user_hash = "{SHA}" .  base64_encode(sha1($password, true));
            } else {
                $this->user_hash = "{CLEAR}" . $password;
            }
            $this->password = $this->user_hash;
        }
    }

    function to_string()
    {
        $tmp_user = $this;
        $tmp_user->invoice = "";
        $tmp_user->password = "***";
        $tmp_user->user_hash = "***";
        return  json_encode($tmp_user);
    }

    function backup_in_session()
    {
        global $_SESSION;
        foreach ($this as $key => $value) {
            $_SESSION[$key] = $value;
        }
    }

    function to_table() {
        $table = "<table  style='border: 1px solid #e1e4e8; border-collapse: collapse; width: 100%;'>";
        foreach ($this as $key => $value) {
            if ($key != "password" && $key != "user_hash" && !empty($value) && $key != "invoice") {
                if (is_bool($value)) {
                    if ($value) $value = "yes";
                    else $value = "no";
                } elseif(is_float($value)) {
                    $key .= " €";
                }
                $value = str_replace("\r\n", "<br>", $value);
                $key = str_replace("_", " ", ucfirst($key));
                $table .= " <tr>
  <td style='border: 1px solid #e1e4e8; padding: 6px 13px;'><strong>$key</strong></td>
  <td style='border: 1px solid #e1e4e8; padding: 6px 13px;'>$value</td>
 </tr>\n";
            }
        }
        $table .= "</table>";
        return $table;
    }
}