<?php

namespace Vinteract\Analytics;

use \Vinteract\Client;

use \Illuminate\Database\Eloquent\Model;

class Installation extends Model {
	
	/*
		Properties
	*/
	
	//protected $with = ["events"];
	
	/*
		Overrides
	*/
	
	public function __construct($attributes = []) {
		
		parent::__construct($attributes);
		
		$this->setTable("global_" . Client::getType() . "_analytics_installations");
		
	}
	
	public function newQuery($excludeDeleted = true) {
		return parent::newQuery($excludeDeleted = true)
			->where("environment", ENVIRONMENT === "development" ? "development" : "production")
			->where("org_id", Client::getId());
	}
	
	/*
		Functions
	*/
	
	/*
		Relationships
	*/
	
	/*public function events() {
		return $this->hasMany("\Vinteract\Analytics\Event", "installation_id", "id");
	}*/
	
}
