<?php
/**
* @author OfficeBrain 4488 <info@officebrain.com>
*
* Description :  Keyword Banner Logs Document
*
**/
namespace OfficeBrain\Bundle\ActivityBundle\Document;

use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;

/**
 * @MongoDB\Document(repositoryClass="OfficeBrain\Bundle\ActivityBundle\Document\KeywordBannerLogRepository")
 */
class KeywordBannerLog
{
    /**
     * @MongoDB\Id
     */
    protected $id;

    /**
     * @MongoDB\Field(type="int")
     */
    protected $userId;
    
    /**
     * @MongoDB\Field(type="string")
     */
    protected $ipAddress;
    
    /**
     * @MongoDB\Field(type="string")
     */
    protected $userAgent;
    
    /**
     * @MongoDB\Field(type="string")
     */
    protected $language;
    
    /**
     * @MongoDB\Field(type="string")
     */
    protected $requestURI;
    /**
     * @MongoDB\Field(type="string")
     */
    protected $hostName;
    
    /**
     * @MongoDB\Field(type="string")
     */
    protected $device;
    
    /**
     * @MongoDB\Field(type="int")
     */
    protected $instanceId;
    
    /**
     * @MongoDB\Field(type="string")
     */
    protected $instanceType;
    
    /**
     * @MongoDB\Field(type="date")
     */
    protected $createdAt;
    
    /**
     * @MongoDB\Field(type="hash")
     */
    private $data;
    
    /**
     * @MongoDB\Field(type="int")
     */
    protected $bannerId;
    
    /**
     * @MongoDB\Field(type="string")
     */
    protected $bannerName;
    /**
     * @MongoDB\Field(type="int")
     */
    Protected $bannerType;
    /**
     * @MongoDB\Field(type="string")
     */
    protected $bannerKeywords;
    /**
     * @MongoDB\Field(type="int")
     */
    protected $bannerCategory;
    /**
     * @MongoDB\Field(type="int")
     */
    protected $productId;
    /**
     * @MongoDB\Field(type="int")
     */
    protected $categoryId;
    /**
     * @MongoDB\Field(type="string")
     */
    protected $viewOn;
  
    /**
     * Get id
     *
     * @return id $id
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set instanceId
     *
     * @param int $instanceId
     * @return self
     */
    public function setInstanceId($instanceId)
    {
        $this->instanceId = $instanceId;
        return $this;
    }

    /**
     * Get instanceId
     *
     * @return int $instanceId
     */
    public function getInstanceId()
    {
        return $this->instanceId;
    }

    /**
     * Set instanceType
     *
     * @param string $instanceType
     * @return self
     */
    public function setInstanceType($instanceType)
    {
        $this->instanceType = $instanceType;
        return $this;
    }

    /**
     * Get instanceType
     *
     * @return string $instanceType
     */
    public function getInstanceType()
    {
        return $this->instanceType;
    }

    /**
     * Set createdAt
     *
     * @param date $createdAt
     * @return self
     */
    public function setCreatedAt($createdAt)
    {
        $this->createdAt = $createdAt;
        return $this;
    }

    /**
     * Get createdAt
     *
     * @return date $createdAt
     */
    public function getCreatedAt()
    {
        return $this->createdAt;
    }

    /**
     * Set userId
     *
     * @param int $userId
     * @return self
     */
    public function setUserId($userId)
    {
        $this->userId = $userId;
        return $this;
    }

    /**
     * Get userId
     *
     * @return int $userId
     */
    public function getUserId()
    {
        return $this->userId;
    }

    /**
     * Set ipAddress
     *
     * @param string $ipAddress
     * @return self
     */
    public function setIpAddress($ipAddress)
    {
        $this->ipAddress = $ipAddress;
        return $this;
    }

    /**
     * Get ipAddress
     *
     * @return string $ipAddress
     */
    public function getIpAddress()
    {
        return $this->ipAddress;
    }

    /**
     * Set userAgent
     *
     * @param string $userAgent
     * @return self
     */
    public function setUserAgent($userAgent)
    {
        $this->userAgent = $userAgent;
        return $this;
    }

    /**
     * Get userAgent
     *
     * @return string $userAgent
     */
    public function getUserAgent()
    {
        return $this->userAgent;
    }

    /**
     * Set language
     *
     * @param string $language
     * @return self
     */
    public function setLanguage($language)
    {
        $this->language = $language;
        return $this;
    }

    /**
     * Get language
     *
     * @return string $language
     */
    public function getLanguage()
    {
        return $this->language;
    }

    /**
     * Set requestURI
     *
     * @param string $requestURI
     * @return self
     */
    public function setRequestURI($requestURI)
    {
        $this->requestURI = $requestURI;
        return $this;
    }

    /**
     * Get requestURI
     *
     * @return string $requestURI
     */
    public function getRequestURI()
    {
        return $this->requestURI;
    }

    /**
     * Set device
     *
     * @param string $device
     * @return self
     */
    public function setDevice($device)
    {
        $this->device = $device;
        return $this;
    }

    /**
     * Get device
     *
     * @return string $device
     */
    public function getDevice()
    {
        return $this->device;
    }
    
    /**
     * Set setRequestInfo
     *
     * @param string $request
     * @return self
     */
    public function setRequestInfo($request)
    {
        $projectSetting = $request->get('project_setting');
        $this->setInstanceType($projectSetting['instance_type']);
        $this->setInstanceId($projectSetting['instance_id']);
        $this->setUserId($projectSetting['user_id']);
        $this->setIpAddress($request->getClientIp());
        $this->setLanguage(serialize($request->getLanguages()));
        $this->setRequestURI($request->getRequestUri());
        $this->setHostName($request->getSchemeAndHttpHost());
        $this->setUserAgent($request->headers->get('User-Agent'));
        $this->setDevice($request->headers->get('User-Agent'));
        $this->setCreatedAt(date('Y-m-d H:i:s'));
    }
    /**
     * Get data
     *
     * @return hash $data
     */
    public function getData()
    {
        return $this->data;
    }
    
    /**
     * Set data
     *
     * @param hash $data
     * @return self
     */
    public function setData($data)
    {
        if (!empty($data)) {
            $this->data = $data;
        } else {
            $this->data =array();
        }
        
        return $this;
    }
    public function getHostName()
    {
        return $this->hostName;
    }
    public function setHostName($hostName)
    {
        $this->hostName = $hostName;
        return $this;
    }
	public function getBannerId() {
		return $this->bannerId;
	}
	public function setBannerId($bannerId) {
		$this->bannerId = $bannerId;
		return $this;
	}
	public function getBannerName() {
		return $this->bannerName;
	}
	public function setBannerName($bannerName) {
		$this->bannerName = $bannerName;
		return $this;
	}
	public function getBannerType() {
		return $this->bannerType;
	}
	public function setBannerType($bannerType) {
		$this->bannerType = $bannerType;
		return $this;
	}
	public function getBannerKeywords() {
		return $this->bannerKeywords;
	}
	public function setBannerKeywords($bannerKeywords) {
		$this->bannerKeywords = $bannerKeywords;
		return $this;
	}
	public function getBannerCategory() {
		return $this->bannerCategory;
	}
	public function setBannerCategory($bannerCategory) {
		$this->bannerCategory = $bannerCategory;
		return $this;
	}
	public function getProductId() {
		return $this->productId;
	}
	public function setProductId($productId) {
		$this->productId = $productId;
		return $this;
	}
	public function getCategoryId() {
		return $this->categoryId;
	}
	public function setCategoryId($categoryId) {
		$this->categoryId = $categoryId;
		return $this;
	}
	public function getViewOn() {
		return $this->viewOn;
	}
	public function setViewOn($viewOn) {
		$this->viewOn = $viewOn;
		return $this;
	}
	
}
