import os

import unicodecsv

from openelex.models import Contest, Candidate, Result
from openelex.us.md import jurisdiction

# Classes that describe election attributes

class MDElection(object):
    """
    Base class for describing Maryland elections.

    Subclasses, should, at the very least, define ``election_id`` and
    ``candidate_counts`` attributes.

    It will also likely be useful to define ``num_{{reporting_level}}_results``
    attributes that contain the known number of results for a particular
    reporting level.
    """

    election_id = None
    """
    Identifier for election.

    This should match the ID from the OpenElections metadata API.
    """

    candidate_counts = {}
    """
    Map of contest slugs to known number of candidates.
    """

    reporting_levels = []
    """
    Iterable of available reporting levels of results in this election.
    """

    counties = jurisdiction.counties
    congressional_districts = jurisdiction.congressional_districts
    state_senate_districts = jurisdiction.state_senate_districts