#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
# !!! DO NOT EDIT THIS FILE - THIS IS GENERATED FILE !!!
# Imports =====================================================================
from collections import namedtuple


# Functions and classes =======================================================

# !!! DO NOT EDIT THIS FILE - THIS IS GENERATED FILE !!!
# !!! DO NOT EDIT THIS FILE - THIS IS GENERATED FILE !!!

_PUB_FIELDS = [
    "title",
    "author",
    "pub_year",
    "isbn",
    "urnnbn",
    "uuid",
    "aleph_id",
    "producent_id",
    "is_public",
    "filename",
    "is_periodical",
    "path",
    "b64_data",
    "url",
    "file_pointer",
]


class Publication(namedtuple('Publication', _PUB_FIELDS)):
    '''
    Communication structure used to sent data to `storage` subsystem over AMQP.

    Attributes:
        title (str): Title of the publication.
        author (str): Name of the author.
        pub_year (str): Year when the publication was released.
        isbn (str): ISBN for the publication.
        urnnbn (str): URN:NBN for the publication.
        uuid (str): UUID string to pair the publication with edeposit.
        aleph_id (str): ID used in aleph.
        producent_id (str): ID used for producent.
        is_public (bool): Is the file public?
        filename (str): Original filename.
        is_periodical (bool): Is the publication periodical?
        path (str): Path in the tree (used for periodicals).
        b64_data (str): Base64 encoded data ebook file.
        url (str): URL in case that publication is public.
        file_pointer (str): Pointer to the file on the file server.
    '''
    def __new__(self, *args, **kwargs):
        for field, arg in zip(_PUB_FIELDS, args):
            kwargs[field] = arg

        for key in _PUB_FIELDS:
            if key not in kwargs:
                kwargs[key] = None

        return super(Publication, self).__new__(self, **kwargs)

    def __init__(self, *args, **kwargs):
        for field, arg in zip(_PUB_FIELDS, args):
            kwargs[field] = arg

        for key, val in kwargs.iteritems():
            if key not in _PUB_FIELDS:
                raise ValueError("Unknown parameter '%s'!" % key)

            self.__dict__[key] = val

# !!! DO NOT EDIT THIS FILE - THIS IS GENERATED FILE !!!
# !!! DO NOT EDIT THIS FILE - THIS IS GENERATED FILE !!!
