""" Resource used for import/export metaplans data.
A documentation about Resource is available in import_export.resources module.
"""

from mtp.apps.import_export import resources

from .models import Metaplan, MetaplanProposition


class MetaplanPropositionResource(resources.Resource):
    """Resource for MetaplanProposition."""
    fields = (
        ('text', 'Proposition text'),
        ('group', 'Group'),
        ('user__username', 'User')
    )


class MetaplanResource(resources.Resource):
    """Resource for Metaplan."""
    fields = ('name',)
    nested_resource = (
        ('propositions', MetaplanPropositionResource),
    )

resources.register(MetaplanProposition, MetaplanPropositionResource)
resources.register(Metaplan, MetaplanResource)
