from .base import (
    CERBERUS_RULE_OPTIONAL_STRING,
    CERBERUS_RULE_REQUIRED_DATETIME_STRING,
)
from .feed import FeedSchema


class ScheduleSchema(FeedSchema):
    def __init__(self):
        super(ScheduleSchema, self).__init__()
        self['episode'] = {
            'type': 'dict',
            'nullable': True,
            'default': None,
            'schema': {
                'start_date': CERBERUS_RULE_REQUIRED_DATETIME_STRING,
                'end_date': CERBERUS_RULE_REQUIRED_DATETIME_STRING,
                'series_id': {'type': 'string', 'nullable': True, 'coerce': str},
                'season_id': {'type': 'string', 'nullable': True, 'coerce': str},
                'episode_id': {'type': 'string', 'nullable': True, 'coerce': str},
                'house_number': CERBERUS_RULE_OPTIONAL_STRING,
                'box_number': CERBERUS_RULE_OPTIONAL_STRING,
            }
        }
