import random

from factory import LazyAttribute, SubFactory
from factory.fuzzy import FuzzyText, FuzzyInteger
from factory.django import DjangoModelFactory


class CountryFactory(DjangoModelFactory):
    """
    Country model factory
    """
    name = FuzzyText(length=12, suffix="_test_name")

    class Meta:
        model = 'geo.Country'


class RegionFactory(DjangoModelFactory):
    """
    Region model factory
    """
    name = FuzzyText(length=12, suffix="_test_name")
    country = SubFactory('geo.factories.CountryFactory')

    class Meta:
        model = 'geo.Region'


class ProvinceFactory(DjangoModelFactory):
    """
    City model factory
    """
    name = FuzzyText(length=12, suffix="_test_name")
    region = SubFactory('geo.factories.RegionFactory')

    class Meta:
        model = 'geo.Province'


class CityFactory(DjangoModelFactory):
    """
    City model factory
    """
    name = FuzzyText(length=12, suffix="_test_name")
    province = SubFactory('geo.factories.ProvinceFactory')

    class Meta:
        model = 'geo.City'

