import unittest

from uuid import UUID

from contacts.Contact import Contact
from contacts.Identifier import Identifier, IdentifierTypes, IdentifierContext


class TestContact(unittest.TestCase):
    def setUp(self):
        self.name = "ash"
        self.phone = "555-1212"
        self.uuid = "00000000-aaaa-1111-bbbb-222222222222"

    def tearDown(self):
        pass

    def test_constructor(self):
        contact = Contact(
            name=self.name,
            notes="yay!",
            identifier=Identifier(
                context=IdentifierContext.Personal,
                key=IdentifierTypes.Phone,
                val=self.phone,
            ),
            uuid=str(UUID(self.uuid)),
        )
        self.assertTrue(contact.name == self.name)
        self.assertTrue(contact.uuid == self.uuid)

    def test_constructor_no_uuid(self):
        contact = Contact(
            name=self.name,
            notes="yay!",
            identifier=Identifier(
                context=IdentifierContext.Personal,
                key=IdentifierTypes.Phone,
                val=self.phone,
            ),
        )
        self.assertTrue(contact.name == self.name)

    # TODO: Validate the types.
    def test_constructor_validate_types(self):
        pass


if __name__ == "__main__":
    unittest.main()
