from .models import Member, Address, Organization, Group


_DEFAULT_TYPES = ("members", "groups", "organizations")


def create_resources(types: tuple[str, ...] = _DEFAULT_TYPES, count=100):

    content: dict = {t: [] for t in types}

    if "members" in types:
        for idx in range(count):
            member = Member(
                username=f"member_{idx}",
                email=f"member_{idx}@example.com",
                first_name="Script",
                last_name=f"User {idx}",
            )
            content["members"].append(member.model_dump())

    if "xorganizations" in types:
        for idx in range(count):
            address = Address(
                line1="Apartment 123",
                line2="123 Street",
                line3="",
                city="City",
                region="Region",
                postcode="abc123",
                country="IE",
            )

            organization = Organization(
                name=f"Organization {idx}",
                acronym=f"ORG {idx}",
                description=f"Description of org {idx}",
                address=address,
                website=f"www.org{idx}.com",
            )

            content["organizations"].append(organization.model_dump())

    if "xgroups" in types:
        for idx in range(count):
            group = Group(name=f"Script Group {idx}")
            content["groups"].append(group.model_dump())

    return content
