# Path: src/pycrunchbase/resource/utils.py
# def parse_date(datelike):
#     """Helper for parsing dates in Organization properties"""
#     try:
#         return datetime.strptime(datelike, "%Y-%m-%d")
#     except ValueError:
#         return datelike


import six
from .node import Node
from .utils import parse_date
class Acquisition(Node):
    """Represents a Acquisition on CrunchBase"""

    KNOWN_PROPERTIES = [
        "api_path",
        "web_path",
        "price",
        "price_currency_code",
        "price_usd",
        "payment_type",
        "acquisition_type",
        "acquisition_status",
        "disposition_of_acquired",
        "announced_on",
        "announced_on_trust_code",
        "completed_on",
        "completed_on_trust_code",
        "created_at",
        "updated_at",
        "permalink",
    ]

    KNOWN_RELATIONSHIPS = [
        "acquirer",
        "acquiree",
    ]

    def _coerce_values(self):
        for attr in ['announced_on', 'completed_on']:
            if getattr(self, attr, None):

# Path: src/pycrunchbase/resource/utils.py
# def parse_date(datelike):
#     """Helper for parsing dates in Organization properties"""
#     try:
#         return datetime.strptime(datelike, "%Y-%m-%d")
#     except ValueError:
#         return datelike


# Path: src/pycrunchbase/resource/acquisition.py
import six
from .node import Node
from .utils import parse_date

class Acquisition(Node):
    """Represents a Acquisition on CrunchBase"""

    KNOWN_PROPERTIES = [
        "api_path",
        "web_path",
        "price",
        "price_currency_code",
        "price_usd",
        "payment_type",
        "acquisition_type",
        "acquisition_status",
        "disposition_of_acquired",
        "announced_on",
        "announced_on_trust_code",
        "completed_on",
        "completed_on_trust_code",
        "created_at",
        "updated_at",
        "permalink",
    ]

    KNOWN_RELATIONSHIPS = [
        "acquirer",
        "acquiree",
    ]

    def _coerce_values(self):
        for attr in ['announced_on', 'completed_on']:
            if getattr(self, attr, None):

                setattr(self, attr, parse_date(getattr(self, attr)))