from typing import Optional
from typing import Any


def make_create_json(
    summary: str,
    project_key: str,
    type_name: str,
    description: Optional[str],
    assignee: Optional[str],
    priority_name: Optional[str],
    labels: Optional[str],
    due_date: Optional[str],
) -> Any:
    """Makes a JSON string for the Jira REST API editing endpoint based on
    fields that could be edited.

    Parameters:
     - summary: The Jira summary property.
     - project_key: The Jira project key property.
     - type_name (optional): The Jira type name property.
     - description (optional): The Jira description property.
     - assignee (optional): The Jira assignee property.
     - priority_name (optional): The Jira priority name property.
     - labels (optional): The Jira labels property, as a string of labels separated by
                          comma-spaces.
     - due_date (optional): The Jira due date property.
    """
    json_fields = {
        "summary": summary,
        "project": {"key": project_key},
        "issuetype": {"name": type_name},
    }
    if description:
        json_fields["description"] = description
    if assignee:
        json_fields["assignee"] = {"name": assignee}
    if priority_name:
        json_fields["priority"] = {"name": priority_name}
    if labels:
        json_fields["labels"] = labels.split(", ")
    if due_date:
        json_fields["duedate"] = due_date

    json = {"fields": json_fields}

    return json