<?php


namespace App\Model\Crates;


use DateTime;
use stdClass;

class SteamProfile
{
    protected $data;

    /**
     * SteamProfile constructor.
     * @param $data
     */
    public function __construct(stdClass $data)
    {
        $this->data = $data;
    }

    public function getSteamId()
    {
        return $this->data->steamid;
    }

    public function getVisibilityState()
    {
        return $this->data->communityvisibilitystate;
    }

    public function getState()
    {
        return $this->data->profilestate;
    }

    public function getNickname()
    {
        return $this->data->personaname;
    }

    /**
     * @return DateTime
     */
    public function getLastOnline()
    {
        $date = new DateTime();
        return $date->setTimestamp($this->data->lastlogoff);
    }

    public function getProfileUrl()
    {
        return $this->data->profileurl;
    }

    public function getAvatarSmallUrl()
    {
        return $this->data->avatar;
    }

    public function getAvatarMediumUrl()
    {
        return $this->data->avatarmedium;
    }

    public function getAvatarLargeUrl()
    {
        return $this->data->avatarfull;
    }

    public function getUserStatus()
    {
        return $this->data->personastate;
    }

    public function getRealName()
    {
        return $this->data->realname;
    }

    public function getPrimaryClanId()
    {
        return $this->data->primaryclanid;
    }

    /**
     * @return $this
     */
    public function getRegisteredAt()
    {
        $date = new DateTime();
        return $date->setTimestamp($this->data->timecreated);
    }

    public function getStateFlags()
    {
        return $this->data->personastateflags;
    }

    public function getCountryCode()
    {
        return $this->data->loccountrycode;
    }

    public function getStateCode()
    {
        return $this->data->locstatecode;
    }

    public function getCityId()
    {
        return $this->data->loccityid;
    }

}