Get a template dictionary that can be used to create a payload object.

    TODO: services s/b a list. Specify required fields for each service in list.
        None means all services.

def get_common_payload_template(services=None):
    """
    Get a template dictionary that can be used to create a payload object.

    TODO: services s/b a list. Specify required fields for each service in list.
        None means all services.
    """
    available_services = {'citrine', 'materials_commons', 'materials_data_facility'}
    if services is None:
        services = list(available_services)
    else:
        services = [service for service in services if service in available_services]
        if not services:
            services = list(available_services)
    combined_requirements = {}
    for service in services:
        # TODO(Recursive check dictionaries to make sure all requirements fields are combined.)
        service_requirements = eval('_%s_metadata_requirements()' % service)
        if service_requirements:
            for key in service_requirements:
                if not key in combined_requirements:
                    combined_requirements[key] = service_requirements[key]
    return {
        'all_fields': {
            'title': 'string',
            'source': {
                'name': 'string',
                'producer': 'string',
                'url': 'url string',
                'tags': ['string']
            },
            'data_contacts': [
                {
                    'given_name': 'string',
                    'family_name': 'string',
                    'title': 'string',
                    'orcid': 'TBD',
                    'email': 'string',
                    'tags': ['string']
                }
            ],
            'data_contributors': [
                {
                    'given_name': 'string',
                    'family_name': 'string',
                    'title': 'string',
                    'orcid': 'TBD',
                    'email': 'string',
                    'tags': ['string']
                }
            ],
            'links': {
                'landing_page': 'uri (string)',
                'publication': ['uri (string)'],
                'data_doi': 'uri (string)',
                'related_id': ['string'],
                'parent_id': 'string'
            },
            'authors': [
                {
                    'given_name': 'string',
                    'family_name': 'string',
                    'title': 'string',
                    'orcid': 'TBD',
                    'email': 'string',
                    'tags': ['string']
                }
            ],
            'licenses': [
                {
                    'name': 'string',
                    'description': 'string',
                    'url': 'string',
                    'tags': ['string']
                }
            ],
            'citations': [
                {
                    'authors': [
                        {
                            'given_name': 'string',
                            'family_name': 'string',
                            'title': 'string',
                            'orcid': 'TBD',
                            'email': 'string',
                            'tags': ['string']
                        }
                    ],
                    'year': 'string',
                    'title': 'string',
                    'journal': 'string',
                    'volume': 'string',
                    'issue': 'string',
                    'page_location': 'string',
                    'edition': 'string',
                    'publication_location': 'string',
                    'publisher': 'string',
                    'extent': 'string',
                    'notes': 'string',
                }
            ],
            'repository': 'not yet available',
            'collection': 'not yet available',
            'tags': ['string'],
            'description': 'string',
            'raw': 'not yet available',
            'year': 'integer',
            'composition': 'not yet available'
        },
        'required_fields': combined_requirements,
        'usage': 'payload = <service class, e.g. CITPayload>(**input_dictionary).metapayload'
    }