<?php
require_once 'vendor/autoload.php';
include_once 'util.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;
    }
}