"""
Generated by <Python Project Utils>
Visit the project in http://code.google.com/p/python-project-utils/
"""

from . import Wrapper
from device import Device

class Folder(Wrapper):
	_table = "folders"
	_attributes_columns = {}
	_attributes_columns["_id"] = "id"
	_attributes_columns["_alias"] = "alias"
	_attributes_columns["_path"] = "path"
	_attributes_columns["_is_compressed"] = "is_compressed"
	_attributes_columns["_compression_engine"] = "compression_engine"
	_attributes_columns["_device_id"] = "device_id"

	@classmethod
	def find_by_alias(cls, alias):
		return cls.find_by_attribute("_alias", alias)

	@classmethod
	def find_by_path(cls, path):
		return cls.find_by_attribute("_path", path)

	def __init__(self, id = None, path = None, alias = None, is_compressed = False, compression_engine = None):
		Wrapper.__init__(self, id)

		self._path = path
		self._alias = alias
		self._is_compressed = is_compressed
                self._compression_engine = compression_engine
		self._games = []
		self._device_id = 0

	def get_path(self):
		return self._path

	def get_alias(self):
		return self._alias

	def get_games(self):
		return self._games

	def get_compression_engine(self):
		return self._compression_engine

	def is_compressed(self):
		return self._is_compressed

	def set_path(self, path):
		self._path = path

	def set_alias(self, alias):
		self._alias = alias

	def set_compression_engine(self, compression_engine):
		self._compression_engine = compression_engine

	def set_is_compressed(self, is_compressed):
		self._is_compressed = is_compressed

	def add_game(self, game):
		self._games.append(game)

	def add_games(self, games):
		self._games.extend(games)

	def _load_parent(self):
		self._parent = Device.find_by_id(self._device_id)
