def get_csv_header(
    reviews_per_paper, num_similar, area_chairs=False, is_global=False
):
    """
    Get the csv output header fields, based on the number of assigned and
    similar reviewers

    Args:
        reviews_per_paper (int): Number of reviews received by each paper
        num_similar (int): The number of similar reviewers/ACs to list for each
            submission in addition to the assigned reviewers
        area_chairs (bool): Whether or not this assignment is for ACs
        is_global (bool): whether or not this header is for the global csv file
            (if ``False``, assumed to be for the track-wise file)

    Returns:
        header (list): Header fields for the output csv file
    """

    if area_chairs:
        role = 'AC'
    else:
        role = 'reviewer'

    # Include ID and assigned reviewers in both the global and track-wise csv
    # headers
    header = ['ID']
    for x in range(1, reviews_per_paper + 1):
        reviewer_field = f'Assigned {role} {x}'
        score_field = f'Assigned {role} {x} score'
        header += [reviewer_field, score_field]

    # To the global header, add track and a flag for whether all reviewers are
    # in the same track. To the track-wise header, add non-assigned similar
    # reviewers, as well as SACs and ACs with COIs
    if is_global:
        header += ['Track', 'Assigned within same track']
    else:
        for x in range(1, num_similar + 1):
            reviewer_field = f'Similar {role} {x}'
            score_field = f'Similar {role} {x} score'
            header += [reviewer_field, score_field]
        header += ['SACs with COI', 'ACs with COI', 'Reviewers with COI']

    return header