from datetime import UTC
from uuid import UUID, uuid4

from template_project.application.user.entity import UserId
from template_project.application.user.profile.entity import Profile


def test_profile_factory_creates_valid_profile() -> None:
    user_id = UserId(uuid4())

    profile = Profile.factory(
        user_id=user_id,
        email="test@example.com",
        display_name="Test User",
        first_name="Test",
        last_name="User",
        avatar_url="https://example.com/avatar.jpg",
        phone="+1234567890",
    )

    assert isinstance(profile.id, UUID)
    assert profile.user_id == user_id
    assert profile.email == "test@example.com"
    assert profile.display_name == "Test User"
    assert profile.first_name == "Test"
    assert profile.last_name == "User"
    assert profile.avatar_url == "https://example.com/avatar.jpg"
    assert profile.phone == "+1234567890"
    assert profile.deleted_at is None
    assert profile.created_at.tzinfo == UTC


def test_profile_factory_with_minimal_fields() -> None:
    user_id = UserId(uuid4())

    profile = Profile.factory(user_id=user_id)

    assert profile.user_id == user_id
    assert profile.email is None
    assert profile.display_name is None
    assert profile.first_name is None
    assert profile.last_name is None
    assert profile.avatar_url is None
    assert profile.phone is None
