class Task:
    def __init__(self, task_data):
        self.title = task_data["title"]
        self.user_id = task_data["user_id"]
        self.created_at = task_data["created_at"]
        self.scheduled_at = task_data["scheduled_at"]
        self.lat = task_data["lat"]
        self.lng = task_data["lng"]
        self.status = task_data["status"]
        self.id = task_data["id"]
        self.address = task_data["address"]
        self.active_way_point_id = task_data["active_way_point_id"]
        self.started_time = task_data["started_time"]
        self.cancelled_at = task_data["cancelled_at"]
        self.cancellation_lat = task_data["cancellation_lat"]
        self.cancellation_lng = task_data["cancellation_lng"]
        self.late = task_data["late"]
        self.extras = task_data["extras"]
        self.external_id = task_data["external_id"]
        self.customer_id = task_data["customer_id"]
        self.asap = task_data["asap"]
        self.ended_time = task_data["ended_time"]
        self.priority = task_data["priority"]
        self.distance_traveled = task_data["distance_traveled"]
        self.total_price = task_data["total_price"]
        self.delivery_cost = task_data["delivery_cost"]
        self.delivery_price = task_data["delivery_price"]
        self.tip = task_data["tip"]
        self.pre_delivery_tip = task_data["pre_delivery_tip"]
        self.post_delivery_tip_cash = task_data["post_delivery_tip_cash"]
        self.post_delivery_tip_credit = task_data["post_delivery_tip_credit"]
        self.left_to_be_paid = task_data["left_to_be_paid"]
        self.task_cancellation_reason = task_data["task_cancellation_reason"]
        self.dispatcher_id = task_data["dispatcher_id"]
        self.uuid = task_data["uuid"]
        self.ready_to_execute = task_data["ready_to_execute"]
        self.discount = task_data["discount"]
        self.tip_driver_enabled = task_data["tip_driver_enabled"]
        self.tax_price = task_data["tax_price"]
        self.price_before_tax = task_data["price_before_tax"]
        self.tag_id = task_data["tag_id"]
        self.group_uuid = task_data["group_uuid"]
        self.group_leader_id = task_data["group_leader_id"]
        self.automatically_cancelled = task_data["automatically_cancelled"]
        self.parent_task_id = task_data["parent_task_id"]
        self.payment_method = task_data["payment_method"]
        self.payment_type_name = task_data["payment_type_name"]
        self.linked_task_id = task_data["linked_task_id"]
        self.preparation_status = task_data["preparation_status"]
        self.preparation_start_time_planned = task_data["preparation_start_time_planned"]
        self.preparation_end_time_planned = task_data["preparation_end_time_planned"]
        self.preparation_ready_for_pickup_time_planned = task_data["preparation_ready_for_pickup_time_planned"]
        self.invalidated = task_data["invalidated"]
        self.automatically_assigned = task_data["automatically_assigned"]
        self.task_type_id = task_data["task_type_id"]
        self.origin_title = task_data["origin_title"]
        self.task_configuration_id = task_data["task_configuration_id"]
        self.required_skills = task_data["required_skills"]
        self.team_ids = task_data["team_ids"]
        self.virtual_task = task_data["virtual_task"]
        self.run_id = task_data["run_id"]
        self.fleet_id = task_data["fleet_id"]
        self.preparation_external_id = task_data["preparation_external_id"]
        self.rank = task_data["rank"]
        self.fleet_delivery_external_id = task_data["fleet_delivery_external_id"]
        self.task_notes = task_data["task_notes"]
        self.way_points = [WayPoint(way_point) for way_point in task_data["way_points"]]
        self.shared_locations = task_data["shared_locations"]
        self.task_inventories = [TaskInventory(inventory) for inventory in task_data["task_inventories"]]
        self.scans = task_data["scans"]
        self.invalid_reasons = task_data["invalid_reasons"]
        self.service_plan = task_data["service_plan"]


class WayPoint:
    def __init__(self, way_point_data):
        self.id = way_point_data["id"]
        self.scheduled_at = way_point_data["scheduled_at"]
        self.has_to_leave_by = way_point_data["has_to_leave_by"]
        self.task_id = way_point_data["task_id"]
        self.customer_id = way_point_data["customer_id"]
        self.done = way_point_data["done"]
        self.lat = way_point_data["lat"]
        self.lng = way_point_data["lng"]
        self.address = way_point_data["address"]
        self.address_second_line = way_point_data["address_second_line"]
        self.zipcode = way_point_data["zipcode"]
        self.position = way_point_data["position"]
        self.checkin_time = way_point_data["checkin_time"]
        self.checkout_time = way_point_data["checkout_time"]
        self.note = way_point_data["note"]
        self.find_me = way_point_data["find_me"]
        self.asap = way_point_data["asap"]
        self.late = way_point_data["late"]
        self.etl = way_point_data["etl"]
        self.eta = way_point_data["eta"]
        self.silent = way_point_data["silent"]
        self.city = way_point_data["city"]
        self.borough = way_point_data["borough"]
        self.full_address = way_point_data["full_address"]
        self.automatic_checkin = way_point_data["automatic_checkin"]
        self.automatic_checkout = way_point_data["automatic_checkout"]
        self.phone = way_point_data["phone"]
        self.email = way_point_data["email"]
        self.no_later_than = way_point_data["no_later_than"]
        self.no_earlier_than = way_point_data["no_earlier_than"]
        self.rating = way_point_data["rating"]
        self.checkin_lat = way_point_data["checkin_lat"]
        self.checkin_lng = way_point_data["checkin_lng"]
        self.checkout_lat = way_point_data["checkout_lat"]
        self.checkout_lng = way_point_data["checkout_lng"]
        self.district = way_point_data["district"]
        self.house_number = way_point_data["house_number"]
        self.company_name = way_point_data["company_name"]
        self.pickup_dropoff_option = way_point_data["pickup_dropoff_option"]
        self.etos = way_point_data["etos"]
        self.address_type = way_point_data["address_type"]
        self.location_name = way_point_data["location_name"]
        self.scheduled_arrival = way_point_data["scheduled_arrival"]
        self.name = way_point_data["name"]
        self.ui_data = way_point_data["ui_data"]
        self.customer = Customer(way_point_data["customer"])


class TaskInventory:
    def __init__(self, inventory_data):
        self.id = inventory_data["id"]
        self.task_id = inventory_data["task_id"]
        self.inventory_id = inventory_data["inventory_id"]
        self.quantity = inventory_data["quantity"]
        self.original_quantity = inventory_data["original_quantity"]
        self.merchant_id = inventory_data["merchant_id"]
        self.name = inventory_data["name"]
        self.price = inventory_data["price"]
        self.image = inventory_data["image"]
        self.way_point_id = inventory_data["way_point_id"]
        self.scan_string = inventory_data["scan_string"]
        self.pending = inventory_data["pending"]
        self.note = inventory_data["note"]
        self.parent_task_inventory_id = inventory_data["parent_task_inventory_id"]
        self.coc_type = inventory_data["coc_type"]
        self.external_id = inventory_data["external_id"]
        self.size = inventory_data["size"]
        self.weight = inventory_data["weight"]
        self.length = inventory_data["length"]
        self.height = inventory_data["height"]
        self.width = inventory_data["width"]
        self.source_task_id = inventory_data["source_task_id"]
        self.rejected_quantity = inventory_data["rejected_quantity"]
        self.assigned_serial = inventory_data["assigned_serial"]
        self.actions_configuration_id = inventory_data["actions_configuration_id"]
        self.scheduled_arrival = inventory_data["scheduled_arrival"]
        self.inventory = Inventory(inventory_data["inventory"])


class Customer:
    def __init__(self, customer_data):
        self.id = customer_data["id"]
        self.name = customer_data["name"]
        self.address = customer_data["address"]
        self.lat = customer_data["lat"]
        self.lng = customer_data["lng"]
        self.created_at = customer_data["created_at"]
        self.updated_at = customer_data["updated_at"]
        self.phone = customer_data["phone"]
        self.merchant_id = customer_data["merchant_id"]
        self.image = customer_data["image"]
        self.access_token = customer_data["access_token"]
        self.confirmation_code = customer_data["confirmation_code"]
        self.salt = customer_data["salt"]
        self.approved = customer_data["approved"]
        self.push_token = customer_data["push_token"]
        self.uuid = customer_data["uuid"]
        self.email = customer_data["email"]
        self.external_id = customer_data["external_id"]
        self.delete_at = customer_data["delete_at"]
        self.facebook_id = customer_data["facebook_id"]
        self.extras = customer_data["extras"]
        self.original_lat_lng_changed = customer_data["original_lat_lng_changed"]
        self.encrypted_password = customer_data["encrypted_password"]
        self.blocked_email = customer_data["blocked_email"]
        self.address_second_line = customer_data["address_second_line"]
        self.zipcode = customer_data["zipcode"]
        self.allow_login = customer_data["allow_login"]
        self.stripe_id = customer_data["stripe_id"]
        self.original_phone_number = customer_data["original_phone_number"]
        self.last_open_at = customer_data["last_open_at"]
        self.last_order_at = customer_data["last_order_at"]
        self.uploaded_profile_image = customer_data["uploaded_profile_image"]
        self.original_lat = customer_data["original_lat"]
        self.original_lng = customer_data["original_lng"]
        self.consecutive_checkins_out_of_geofence = customer_data["consecutive_checkins_out_of_geofence"]
        self.allow_sending_email = customer_data["allow_sending_email"]
        self.allow_sending_sms = customer_data["allow_sending_sms"]
        self.reset_password_token = customer_data["reset_password_token"]
        self.reset_password_sent_at = customer_data["reset_password_sent_at"]
        self.mobile_version = customer_data["mobile_version"]
        self.mobile_type = customer_data["mobile_type"]
        self.mobile_maker = customer_data["mobile_maker"]
        self.client_version = customer_data["client_version"]
        self.client_name = customer_data["client_name"]
        self.city = customer_data["city"]
        self.borough = customer_data["borough"]
        self.state = customer_data["state"]
        self.dev = customer_data["dev"]
        self.business_code = customer_data["business_code"]
        self.language = customer_data["language"]
        self.district = customer_data["district"]
        self.house_number = customer_data["house_number"]
        self.street = customer_data["street"]
        self.allow_dynamically_updating_location = customer_data["allow_dynamically_updating_location"]
        self.is_sales_rep = customer_data["is_sales_rep"]
        self.address_type = customer_data["address_type"]
        self.tax_payer_external_id = customer_data["tax_payer_external_id"]
        self.tax_payer_name = customer_data["tax_payer_name"]
        self.rank = customer_data["rank"]
        self.user_id = customer_data["user_id"]


class Inventory:
    def __init__(self, inventory_data):
        self.id = inventory_data["id"]
        self.name = inventory_data["name"]
        self.price = inventory_data["price"]
        self.image = inventory_data["image"]
        self.merchant_id = inventory_data["merchant_id"]
        self.external_id = inventory_data["external_id"]
        self.scan_string = inventory_data["scan_string"]
        self.commodity = inventory_data["commodity"]
        self.notes = inventory_data["notes"]
        self.weight = inventory_data["weight"]
        self.size = inventory_data["size"]
        self.extras = inventory_data["extras"]
        self.delivery_cost = inventory_data["delivery_cost"]
        self.completed = inventory_data["completed"]
        self.width = inventory_data["width"]
        self.height = inventory_data["height"]
        self.length = inventory_data["length"]
        self.volume = inventory_data["volume"]
        self.description = inventory_data["description"]
        self.limitations = inventory_data["limitations"]
        self.age_restricted = inventory_data["age_restricted"]


class NoteTypes:
    text = "TaskNote"
    photo = "TaskPhoto"
    signature = "TaskSignature"
    form = "Form"
    hyperlink = "HtmlTaskNote"
    document = "Document"


class TaskNote:
    def __init__(self, task_id: int, reported_time: int, note: str):
        self.task_id = task_id
        self.reported_time = reported_time
        self.note = note
        self.type = NoteTypes.text
