# Copyright (c) 2015, InfluxFramework LLC
# License: GNU General Public License v3. See license.txt


import copy

import influxframework
from influxframework.model.document import Document


class Brand(Document):
	pass


def get_brand_defaults(item, company):
	item = influxframework.get_cached_doc("Item", item)
	if item.brand:
		brand = influxframework.get_cached_doc("Brand", item.brand)

		for d in brand.brand_defaults or []:
			if d.company == company:
				row = copy.deepcopy(d.as_dict())
				row.pop("name")
				return row

	return influxframework._dict()
