"""This module holds the factories for the ``media`` app"""

import factory

from mtp.apps.trainings.factories import TrainingFactory

from .models import (
    Note,
    PdfMedia,
    Presentation,
    PresentationMedia,
    Video,
    VideoMedia,
)


class VideoMediaFactory(factory.django.DjangoModelFactory):
    """Factory for the ``VideoMedia`` model"""

    file = factory.django.FileField(filename='video.mov')

    class Meta:
        model = VideoMedia


class VideoFactory(factory.django.DjangoModelFactory):
    """Factory for the ``Video`` model"""

    name = factory.Sequence(lambda n: 'Video-%d' % n)
    media = factory.SubFactory(VideoMediaFactory)
    training = factory.SubFactory(TrainingFactory)

    class Meta:
        model = Video


class PdfMediaFactory(factory.django.DjangoModelFactory):
    """Factory for the ``PdfMedia`` model"""

    file = factory.django.FileField(filename='file.pdf')

    class Meta:
        model = PdfMedia


class PresentationFactory(factory.django.DjangoModelFactory):
    """Factory for the ``Presentation`` model"""

    name = factory.Sequence(lambda n: 'Presentation-%d' % n)
    training = factory.SubFactory(TrainingFactory)

    class Meta:
        model = Presentation


class PresentationMediaFactory(factory.django.DjangoModelFactory):
    """Factory for the ``PresentationMediaContent`` model"""

    media = factory.SubFactory(PdfMediaFactory)
    presentation = factory.SubFactory(PresentationFactory)

    class Meta:
        model = PresentationMedia


class NoteFactory(factory.django.DjangoModelFactory):
    """Factory for the ``Note`` model"""

    content = factory.Sequence(lambda n: 'Note-%d' % n)

    class Meta:
        model = Note
