"""
Factory definitions for unit test data generation using Factory Boy and Faker.

These factories generate plain dictionaries (not Django models) to simulate input data
for validators such as service, team, integration configurations, organization setup,
user info, SSO, and more.

Author: Md. Fahim Bin Amin & Asif Al Shahariar
"""

from faker import Faker
from utils import constants, roles, var_names
import configuration as configs
import factory
import pytz
import random


# Faker instance to generate realistic fake data
fake = Faker()


# ===================== Service-Level Factories =====================

class ServiceFactory(factory.Factory):
    """
    Factory to generate mock service data as a dictionary.
    """
    class Meta:
        model = dict

    name = factory.LazyAttribute(lambda _: fake.company())
    description = factory.LazyAttribute(lambda _: fake.text())
    team = factory.LazyAttribute(lambda _: fake.word())
    integration_details = factory.LazyAttribute(lambda _: fake.url())


class TeamFactory(factory.Factory):
    """
    Factory to generate mock team data as a dictionary.
    """
    class Meta:
        model = dict

    name = factory.LazyAttribute(lambda _: fake.word())
    description = factory.LazyAttribute(lambda _: fake.sentence())


class IntegrationDetailsFactory(factory.Factory):
    """
    Factory to generate mock integration configuration as a dictionary.
    """
    class Meta:
        model = dict

    integration_type = factory.LazyAttribute(lambda _: fake.word())
    endpoint = factory.LazyAttribute(lambda _: fake.url())
    api_key = factory.LazyAttribute(lambda _: fake.uuid4())


