{
    "type": "object",
    "properties": {
        "templates": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "description": "Unique identifier for the template"
                    },
                    "name": {
                        "type": "string",
                        "description": "Template name"
                    },
                    "subject": {
                        "type": "string",
                        "description": "Email subject line template"
                    },
                    "locationId": {
                        "type": "string",
                        "description": "Location ID associated with the template"
                    },
                    "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"
                            },
                            "preview": {
                                "type": "string",
                                "description": "Template preview/excerpt"
                            },
                            "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"
                    },
                    "lastUsed": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When the template was last used"
                    },
                    "usageCount": {
                        "type": "integer",
                        "description": "Number of times this template has been used"
                    },
                    "analytics": {
                        "type": "object",
                        "properties": {
                            "totalSent": {
                                "type": "integer",
                                "description": "Total emails sent using this template"
                            },
                            "averageOpenRate": {
                                "type": "number",
                                "description": "Average open rate for emails using this template"
                            },
                            "averageClickRate": {
                                "type": "number",
                                "description": "Average click rate for emails using this template"
                            }
                        },
                        "description": "Template performance analytics"
                    }
                }
            },
            "description": "Array of email templates"
        },
        "pagination": {
            "type": "object",
            "properties": {
                "total": {
                    "type": "integer",
                    "description": "Total number of templates"
                },
                "count": {
                    "type": "integer",
                    "description": "Number of templates in this response"
                },
                "limit": {
                    "type": "integer",
                    "description": "Maximum number per page"
                },
                "offset": {
                    "type": "integer",
                    "description": "Current offset"
                },
                "hasMore": {
                    "type": "boolean",
                    "description": "Whether there are more results"
                }
            },
            "description": "Pagination information"
        },
        "filters": {
            "type": "object",
            "properties": {
                "type": {
                    "type": "string",
                    "description": "Filter applied by template type"
                },
                "category": {
                    "type": "string",
                    "description": "Filter applied by template category"
                },
                "isActive": {
                    "type": "boolean",
                    "description": "Filter applied by active status"
                }
            },
            "description": "Applied filters"
        }
    },
    "version": 1
}
