import factory

from bluebottle.organizations.models import OrganizationContact, Organization, OrganizationMember
from .geo import CountryFactory
from .accounts import BlueBottleUserFactory


class OrganizationFactory(factory.DjangoModelFactory):
    class Meta(object):
        model = Organization

    name = factory.Sequence(lambda n: 'Organization_{0}'.format(n))
    slug = factory.Sequence(lambda n: 'organization_{0}'.format(n))
    address_line1 = "'s Gravenhekje 1a"
    address_line2 = '1011 TG'
    city = 'Amsterdam'
    state = 'North Holland'
    country = factory.SubFactory(CountryFactory, name='Netherlands')
    postal_code = '1011TG'

    # Contact
    phone_number = '(+31) 20 715 8980'
    website = 'http://onepercentclub.com'

    email = 'info@onepercentclub.com'


class OrganizationContactFactory(factory.DjangoModelFactory):
    class Meta(object):
        model = OrganizationContact

    name = factory.Sequence(lambda n: 'Contact_{0}'.format(n))
    phone = factory.Sequence(lambda n: '555-{0}'.format(n))
    email = factory.Sequence(lambda n: '{0}@example.com'.format(n))
    owner = factory.SubFactory(BlueBottleUserFactory)
    organization = factory.SubFactory(OrganizationFactory)


class OrganizationMemberFactory(factory.DjangoModelFactory):
    class Meta(object):
        model = OrganizationMember

    user = factory.SubFactory(BlueBottleUserFactory)
    function = 'owner'
    organization = factory.SubFactory(OrganizationFactory)

@@ -90,28 +90,8 @@
 tion
-, OrganizationMember
 %0Afro
@@ -1195,262 +1195,4 @@
 ry)%0A
-%0A%0Aclass OrganizationMemberFactory(factory.DjangoModelFactory):%0A    class Meta(object):%0A        model = OrganizationMember%0A%0A    user = factory.SubFactory(BlueBottleUserFactory)%0A    function = 'owner'%0A    organization = factory.SubFactory(OrganizationFactory)%0A

Remove unused org member in factory