import warnings


def process_interaction_params(parameters):
    """Formats and completes interaction parameters.

    Interaction parameters are combined into a dictionary passed as a single argumnet.

    Parameters
    ----------

    color: tuple
        Format (r,g,b).
    headheight: float
        Height of interaction head.
    headwidth: float
        Width of interaction head.
    zorder: int
        Matplotlib zorder value of
        the interaction.
    direction: string
        Determines what side of the
        construct the interaction is
        drawn on; 'forward' or 'reverse'.
    linewidth: float
        Determines the width of lines
        used to draw the interaction.
    heightskew: float
        Skews the total height of the
        interaction.
    sending_length_skew: float
        Skews the length of the origin
        line of the interaction.
    receiving_length_skew: float
        Skews the length of the
        receiving line of the
        interaction.
    distance_from_baseline: float
        Skews the distance between the
        interaction and the baseline.
    """
    final_parameters = {'color': (0,0,0),
                        'headheight': 7.0,
                        'headwidth': 7.0,
                        'zorder': 0,
                        'direction': 'forward',
                        'linewidth': 1.0,
                        'heightskew': 10.0,
                        'sending_length_skew': 0.0,
                        'receiving_length_skew': 0.0,
                        'distance_from_baseline': 10.0}
    if parameters is None:
        return final_parameters
    # Collate interaction parameters
    for key in parameters:
        if key in final_parameters:
            final_parameters[key] = parameters[key]
        else:
            warnings.warn(f"""'{key}' is not a valid interaction parameter.""")
    # Amplify zorder to ensure all drawings composing the interaction can be grouped on Z axis
    final_parameters['zorder'] *= 100
    return final_parameters