<?php
namespace Entity\OAuth;

/** 
 * @Entity(repositoryClass="VetLogic\ORM\EntityRepository")
 * @Table(name="oauth_consumer") 
 */
class Consumer extends \VetLogic\Entity
{
	/** 
	 * @Id @Column(type="integer")
	 * @GeneratedValue
	 */
	protected $id;

	/** @Column(type="smallint",nullable=true) */
	protected $dsid;

	/** @Column(type="integer",nullable=true) */
	protected $rid;

	/** @Column(type="integer") */
	protected $groupId;

	/** @Column(type="smallint",nullable=true) */
	protected $companyId;

	/** @Column(type="integer",nullable=true) */
	protected $userId;

	/** @Column(name="`key`",type="string") */
	protected $key;

	/** @Column(type="string") */
	protected $secret;

	/**
	 * @ManyToOne(targetEntity="Entity\Group",fetch="EAGER")
	 * @JoinColumn(name="groupId",nullable=false)
	 */
	protected $group;

	/**
	 * @ManyToOne(targetEntity="Entity\Company",fetch="EAGER")
	 * @JoinColumn(name="companyId",nullable=false)
	 */
	protected $company;

	/**
	 * @ManyToOne(targetEntity="Entity\Clinic",fetch="EAGER")
	 * @JoinColumns({
	 * 		@JoinColumn(name="dsid",referencedColumnName="dsid"),
	 * 		@JoinColumn(name="rid",referencedColumnName="rid")
	 * })
	 */
	protected $clinic;

	/**
	 * @ManyToOne(targetEntity="Entity\User",fetch="EAGER")
	 * @JoinColumn(name="userId",nullable=false)
	 */
	protected $user;

	/**
	 * @OneToMany(targetEntity="Entity\OAuth\Consumer\Nonce", mappedBy="consumer", fetch="EAGER")
	 */
	protected $nonces;
}
