{
    "type": "object",
    "properties": {
        "template": {
            "type": "object",
            "properties": {
                "id": {
                    "type": "string",
                    "description": "Unique identifier for the created template"
                },
                "name": {
                    "type": "string",
                    "description": "Template name"
                },
                "subject": {
                    "type": "string",
                    "description": "Email subject line template"
                },
                "locationId": {
                    "type": "string",
                    "description": "Location ID where the template was created"
                },
                "type": {
                    "type": "string",
                    "enum": ["email", "sms", "notification"],
                    "description": "Type of template"
                },
                "category": {
                    "type": "string",
                    "enum": ["marketing", "transactional", "automated", "drip", "welcome", "followup"],
                    "description": "Template category"
                },
                "content": {
                    "type": "object",
                    "properties": {
                        "html": {
                            "type": "string",
                            "description": "HTML content of the template"
                        },
                        "text": {
                            "type": "string",
                            "description": "Plain text content of the template"
                        },
                        "design": {
                            "type": "object",
                            "description": "Design/layout information"
                        }
                    },
                    "description": "Template content"
                },
                "variables": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "name": {
                                "type": "string",
                                "description": "Variable name"
                            },
                            "type": {
                                "type": "string",
                                "enum": ["text", "number", "date", "boolean", "url", "email"],
                                "description": "Variable type"
                            },
                            "defaultValue": {
                                "type": "string",
                                "description": "Default value for the variable"
                            },
                            "required": {
                                "type": "boolean",
                                "description": "Whether the variable is required"
                            },
                            "description": {
                                "type": "string",
                                "description": "Variable description"
                            }
                        }
                    },
                    "description": "Template variables/placeholders"
                },
                "settings": {
                    "type": "object",
                    "properties": {
                        "trackOpens": {
                            "type": "boolean",
                            "description": "Whether to track email opens"
                        },
                        "trackClicks": {
                            "type": "boolean",
                            "description": "Whether to track link clicks"
                        },
                        "enableUnsubscribe": {
                            "type": "boolean",
                            "description": "Whether to include unsubscribe link"
                        },
                        "previewText": {
                            "type": "string",
                            "description": "Email preview text"
                        },
                        "fromEmail": {
                            "type": "string",
                            "description": "Default sender email"
                        },
                        "fromName": {
                            "type": "string",
                            "description": "Default sender name"
                        },
                        "replyTo": {
                            "type": "string",
                            "description": "Default reply-to email"
                        }
                    },
                    "description": "Template settings"
                },
                "tags": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    },
                    "description": "Template tags for organization"
                },
                "isActive": {
                    "type": "boolean",
                    "description": "Whether the template is active"
                },
                "isDefault": {
                    "type": "boolean",
                    "description": "Whether this is a default template"
                },
                "createdBy": {
                    "type": "string",
                    "description": "User ID who created the template"
                },
                "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Template creation timestamp"
                },
                "updatedAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Last update timestamp"
                },
                "usageCount": {
                    "type": "integer",
                    "description": "Number of times this template has been used"
                }
            },
            "description": "Created template details"
        },
        "success": {
            "type": "boolean",
            "description": "Whether the template was created successfully"
        }
    },
    "version": 1
}
