from jsonmodels import models, fields, errors, validators

"""
This is a data model for the JSON that Arclight expects 
to be POSTed to Solr.
"""

class SolrCollection(models.Base):
    id = fields.StringField(required=True)
    unitid_ssm = fields.ListField(str)
    unitid_teim = fields.ListField(str)
    title_ssm = fields.ListField(str)
    #title_teim = fields.ListField(str)
    unitdate_ssm = fields.ListField(str)
    #unitdate_bulk_ssim
    #unitdate_inclusive_ssm
    #unitdate_other_ssim
    date_range_sim = fields.ListField(int)
    extent_ssm = fields.ListField(str)
    language_ssm = fields.ListField(str)
    abstract_ssm = fields.ListField(str)
    collection_ssm = fields.ListField(str)
    collection_sim = fields.ListField(str)
    collection_ssi = fields.ListField(str)
    collection_title_tesim = fields.ListField(str)
    accessrestrict_ssm = fields.ListField(str)
    scopecontent_ssm = fields.ListField(str)
    repository_ssm = fields.ListField(str)
    repository_sim = fields.ListField(str)
    ead_ssi = fields.ListField(str)
    collection_unitid_ssm = fields.ListField(str)
    collection_unitid_teim = fields.ListField(str)
    level_ssm = fields.ListField(str)
    level_sim = fields.ListField(str)
    creator_ssm = fields.ListField(str)
    creator_ssim = fields.ListField(str)
    creators_ssim = fields.ListField(str)
    has_online_content_ssim = fields.ListField(str)
    normalized_title_ssm = fields.ListField(str)
    normalized_date_ssm = fields.ListField(str)
    names_coll_ssim = fields.ListField(str)
    names_ssim = fields.ListField(str)
    corpname_ssm = fields.ListField(str)
    famname_ssm = fields.ListField(str)
    persname_ssm = fields.ListField(str)
    creator_corpname_ssm = fields.ListField(str)
    creator_famname_ssm = fields.ListField(str)
    creator_persname_ssm = fields.ListField(str)
    creator_name_ssm = fields.ListField(str)
    creator_corpname_ssim = fields.ListField(str)
    creator_famname_ssim = fields.ListField(str)
    creator_persname_ssim = fields.ListField(str)
    creator_name_ssim = fields.ListField(str)
    access_subjects_ssim = fields.ListField(str)
    access_subjects_ssm = fields.ListField(str)
    geogname_ssm = fields.ListField(str)
    geogname_sim = fields.ListField(str)
    places_sim = fields.ListField(str)
    places_ssim = fields.ListField(str)
    places_ssm = fields.ListField(str)
    acqinfo_ssim = fields.ListField(str)
    accruals_ssm = fields.ListField(str)
    altformavail_ssm = fields.ListField(str)
    appraisal_ssm = fields.ListField(str)
    arrangement_ssm = fields.ListField(str)
    bibliography_ssm = fields.ListField(str)
    bioghist_ssm = fields.ListField(str)
    custodhist_ssm = fields.ListField(str)
    fileplan_ssm = fields.ListField(str)
    note_ssm = fields.ListField(str)
    odd_ssm = fields.ListField(str)
    originalsloc_ssm = fields.ListField(str)
    otherfindaid_ssm = fields.ListField(str)
    phystech_ssm = fields.ListField(str)
    prefercite_ssm = fields.ListField(str)
    processinfo_ssm = fields.ListField(str)
    relatedmaterial_ssm = fields.ListField(str)
    separatedmaterial_ssm = fields.ListField(str)
    userestrict_ssm = fields.ListField(str)
    materialspec_ssm = fields.ListField(str)
    physloc_ssm = fields.ListField(str)
    containers_ssim = fields.ListField(str)
    digital_objects_ssm = fields.ListField(str)
    components = fields.ListField()

    # I guess collections can have representative DAOs
    href_sim = fields.StringField()
    label_ssm = fields.StringField()
    identifier_sim = fields.StringField()
    is_representative_sim = fields.StringField()
    filename_sim = fields.StringField()
    mime_type_sim = fields.StringField()
    #metadata = fields.ListField(dict)
    thumbnail_href_sim = fields.StringField()
    rights_statement_ssm = fields.StringField()
    #content_ssm = fields.StringField()
    

class SolrComponent(SolrCollection):
    parent_ssim = fields.ListField(str)
    #parent_ssm = fields.ListField(str)
    parent_ssi = fields.ListField(str)
    parent_levels_ssm = fields.ListField(str)
    parent_unittitles_ssm = fields.ListField(str)
    parent_unittitles_teim = fields.ListField(str)
    component_level_isim = fields.ListField(int)
    collection_creator_ssm = fields.ListField(str)
    child_component_count_isim = fields.ListField(int)
    parent_access_restrict_ssm = fields.ListField(str)
    parent_access_terms_ssm = fields.ListField(str)
    title_filing_si = fields.StringField()
    ref_ssm = fields.ListField(str)
    ref_ssi = fields.StringField()
