import json


def course_enrollment_widget_props(context):
    """
    Return a json dumps which contains all course_run's properties required by
    CourseEnrollment React widget
    """
    course_run = context["run"]

    return json.dumps(
        {
            "courseRun": {
                "id": course_run.id,
                "resource_link": course_run.resource_link,
                "priority": course_run.state["priority"],
            }
        }
    )