# Path: api_v3/models/expense.py
# class Expense(models.Model):
#     """Ticket expense model."""
# 
#     ticket = models.ForeignKey(
#         Ticket, blank=False, related_name='expenses', db_index=True,
#         on_delete=models.DO_NOTHING)
#     user = models.ForeignKey(
#         settings.AUTH_USER_MODEL, blank=False, db_index=True,
#         on_delete=models.DO_NOTHING)
# 
#     amount = MoneyField(
#         max_digits=19, decimal_places=4, null=True,
#         default_currency=CURRENCIES['USD'].code)
# 
#     rating = models.IntegerField(default=0)
#     scope = models.CharField(max_length=255, blank=False, null=False)
#     payment_method = models.CharField(max_length=255, null=True, blank=True)
#     notes = models.TextField(blank=True, null=True)
#     created_at = models.DateTimeField(default=datetime.utcnow)
#     updated_at = models.DateTimeField(auto_now=True)
# 
#     @classmethod
#     def filter_by_user(cls, user, queryset=None):
#         """Returns any user accessible expenses.
# 
#         Only ticket responders have access to the expenses.
#         """
#         if queryset is None:
#             queryset = cls.objects
# 
#         return queryset.filter(ticket__responder_users=user)
# 
# Path: api_v3/factories/profile.py
# class ProfileFactory(DjangoModelFactory):
# 
#     class Meta:
#         model = Profile
# 
#     email = Faker('email')
#     first_name = Faker('first_name')
#     last_name = Faker('last_name')
#     bio = Faker('job')
#     last_login = Faker('past_date', start_date='-30d')
# 
# Path: api_v3/factories/support.py

# 
# Path: api_v3/factories/ticket.py
# class TicketFactory(DjangoModelFactory):
# 
#     class Meta:
#         model = Ticket
# 
#     requester = SubFactory(ProfileFactory)
# 
#     status = Faker(
#         'random_element', elements=[s[0] for s in Ticket.STATUSES])
#     kind = Faker(
#         'random_element', elements=[k[0] for k in Ticket.KINDS])
#     request_type = Faker(
#         'random_element', elements=[t[0] for t in Ticket.TYPES])
#     priority = Faker(
#         'random_element', elements=[t[0] for t in Ticket.PRIORITIES])
#     sensitive = Faker('random_element', elements=[True, False])
#     whysensitive = Faker('catch_phrase')
#     deadline_at = Faker('future_datetime', end_date='+30d')
#     countries = Faker(
#         'random_sample', elements=[t[0] for t in COUNTRIES], length=3)
# 
#     background = Faker('bs')
# 
#     first_name = Faker('first_name')
#     last_name = Faker('last_name')
#     born_at = Faker('past_datetime', start_date='-30y')
#     connections = Faker('company')
#     sources = Faker('name')
#     business_activities = Faker('catch_phrase')
# 
#     company_name = Faker('company')
#     country = Faker('random_element', elements=[c[0] for c in COUNTRIES])


from djmoney.settings import CURRENCY_CHOICES
from api_v3.models import Expense
from .profile import ProfileFactory
from .support import DjangoModelFactory, Faker, SubFactory
from .ticket import TicketFactory



class ExpenseFactory(DjangoModelFactory):

    class Meta:
        model = Expense

    ticket = SubFactory(TicketFactory)

# Path: api_v3/models/expense.py
# class Expense(models.Model):
#     """Ticket expense model."""
# 
#     ticket = models.ForeignKey(
#         Ticket, blank=False, related_name='expenses', db_index=True,
#         on_delete=models.DO_NOTHING)
#     user = models.ForeignKey(
#         settings.AUTH_USER_MODEL, blank=False, db_index=True,
#         on_delete=models.DO_NOTHING)
# 
#     amount = MoneyField(
#         max_digits=19, decimal_places=4, null=True,
#         default_currency=CURRENCIES['USD'].code)
# 
#     rating = models.IntegerField(default=0)
#     scope = models.CharField(max_length=255, blank=False, null=False)
#     payment_method = models.CharField(max_length=255, null=True, blank=True)
#     notes = models.TextField(blank=True, null=True)
#     created_at = models.DateTimeField(default=datetime.utcnow)
#     updated_at = models.DateTimeField(auto_now=True)
# 
#     @classmethod
#     def filter_by_user(cls, user, queryset=None):
#         """Returns any user accessible expenses.
# 
#         Only ticket responders have access to the expenses.
#         """
#         if queryset is None:
#             queryset = cls.objects
# 
#         return queryset.filter(ticket__responder_users=user)
# 
# Path: api_v3/factories/profile.py
# class ProfileFactory(DjangoModelFactory):
# 
#     class Meta:
#         model = Profile
# 
#     email = Faker('email')
#     first_name = Faker('first_name')
#     last_name = Faker('last_name')
#     bio = Faker('job')
#     last_login = Faker('past_date', start_date='-30d')
# 
# Path: api_v3/factories/support.py

# 
# Path: api_v3/factories/ticket.py
# class TicketFactory(DjangoModelFactory):
# 
#     class Meta:
#         model = Ticket
# 
#     requester = SubFactory(ProfileFactory)
# 
#     status = Faker(
#         'random_element', elements=[s[0] for s in Ticket.STATUSES])
#     kind = Faker(
#         'random_element', elements=[k[0] for k in Ticket.KINDS])
#     request_type = Faker(
#         'random_element', elements=[t[0] for t in Ticket.TYPES])
#     priority = Faker(
#         'random_element', elements=[t[0] for t in Ticket.PRIORITIES])
#     sensitive = Faker('random_element', elements=[True, False])
#     whysensitive = Faker('catch_phrase')
#     deadline_at = Faker('future_datetime', end_date='+30d')
#     countries = Faker(
#         'random_sample', elements=[t[0] for t in COUNTRIES], length=3)
# 
#     background = Faker('bs')
# 
#     first_name = Faker('first_name')
#     last_name = Faker('last_name')
#     born_at = Faker('past_datetime', start_date='-30y')
#     connections = Faker('company')
#     sources = Faker('name')
#     business_activities = Faker('catch_phrase')
# 
#     company_name = Faker('company')
#     country = Faker('random_element', elements=[c[0] for c in COUNTRIES])


# Path: api_v3/factories/expense.py
from djmoney.settings import CURRENCY_CHOICES
from api_v3.models import Expense
from .profile import ProfileFactory
from .support import DjangoModelFactory, Faker, SubFactory
from .ticket import TicketFactory




class ExpenseFactory(DjangoModelFactory):

    class Meta:
        model = Expense

    ticket = SubFactory(TicketFactory)

    user = SubFactory(ProfileFactory)