from iso8601 import iso8601
from typing import Dict


class Conditions(object):
    def __init__(self, obj):
        # type: (Dict) -> None

        self.user_min_level = obj.get("userMinLevel")
        self.unique_for_sale = bool(obj.get("uniqueForSale"))
        self.ignore_burned_items = bool(obj.get("ignoreBurnedItems"))
        self.single_use = bool(obj.get("singleUse")) or self.ignore_burned_items
        self.burn_items = bool(obj.get("burnItems", True))
        self.pod_type = obj.get("podType", None)
        self.min_sale_amount = obj.get("minSaleAmount", None)
        self.max_sale_amount = obj.get("maxSaleAmount", None)
        self.valid_start_period = obj.get("validStartPeriod", None)
        self.valid_end_period = obj.get("validEndPeriod", None)
        self.valid_hours = obj.get("validHours", None)
        self.valid_days = obj.get("validDays", None)
        self.required_items_on_sale = obj.get("requiredItemsOnSale", [])
        self.service_type = obj.get("serviceType", None)
        self.sale_type = obj.get("saleType", None)
        self.sector = obj.get("sector", None)
        self.min_seats = obj.get("minSeats")
        self.discount_max_value = obj.get("discountMaxValue")
        self.service_period = obj.get("servicePeriods", None)
        self.brands = obj.get("brands", None)
        self.required_groups_on_sale = obj.get("requiredGroupsOnSale", [])
