{
    "info": {
        "description": "External API for survey vote counts.",
        "title": "Talque Survey API",
        "version": "1.0.0"
    },
    "paths": {
        "/api/v1/survey/vote/count": {
            "post": {
                "summary": "Get survey vote counts",
                "description": "Returns vote tally for a survey (requires authentication).",
                "parameters": [
                    {
                        "name": "X-TQ-CLIENT-ID",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "The API client ID for authentication."
                    },
                    {
                        "name": "X-TQ-SECRET",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "The API client secret for authentication."
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "orgId": {
                                        "type": "string",
                                        "description": "The unique identifier of the organization."
                                    },
                                    "surveyId": {
                                        "type": "string",
                                        "description": "The unique identifier of the survey."
                                    },
                                    "embedding": {
                                        "oneOf": [
                                            {
                                                "type": "object",
                                                "properties": {
                                                    "embeddingKind": {
                                                        "type": "string",
                                                        "enum": [
                                                            "LECTURE"
                                                        ]
                                                    },
                                                    "eventId": {
                                                        "type": "string",
                                                        "description": "The event/lecture ID."
                                                    }
                                                },
                                                "required": [
                                                    "embeddingKind",
                                                    "eventId"
                                                ]
                                            },
                                            {
                                                "type": "object",
                                                "properties": {
                                                    "embeddingKind": {
                                                        "type": "string",
                                                        "enum": [
                                                            "POST"
                                                        ]
                                                    },
                                                    "postId": {
                                                        "type": "string",
                                                        "description": "The post ID."
                                                    }
                                                },
                                                "required": [
                                                    "embeddingKind",
                                                    "postId"
                                                ]
                                            }
                                        ],
                                        "description": "The embedding context of the survey."
                                    }
                                },
                                "required": [
                                    "orgId",
                                    "surveyId",
                                    "embedding"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Survey vote tally",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "orgId": {
                                            "type": "string",
                                            "description": "The unique identifier of the organization."
                                        },
                                        "surveyId": {
                                            "type": "string",
                                            "description": "The unique identifier of the survey."
                                        },
                                        "embedding": {
                                            "oneOf": [
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "embeddingKind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "LECTURE"
                                                            ]
                                                        },
                                                        "eventId": {
                                                            "type": "string",
                                                            "description": "The event/lecture ID."
                                                        }
                                                    },
                                                    "required": [
                                                        "embeddingKind",
                                                        "eventId"
                                                    ]
                                                },
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "embeddingKind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "POST"
                                                            ]
                                                        },
                                                        "postId": {
                                                            "type": "string",
                                                            "description": "The post ID."
                                                        }
                                                    },
                                                    "required": [
                                                        "embeddingKind",
                                                        "postId"
                                                    ]
                                                }
                                            ],
                                            "description": "The embedding context of the survey."
                                        },
                                        "survey": {
                                            "type": "object",
                                            "properties": {
                                                "surveyId": {
                                                    "type": "string",
                                                    "description": "The unique identifier of the survey."
                                                },
                                                "name": {
                                                    "type": "object",
                                                    "description": "Translated name of the survey."
                                                },
                                                "adminName": {
                                                    "type": "string",
                                                    "description": "Internal admin name of the survey."
                                                },
                                                "lifecycle": {
                                                    "type": "string",
                                                    "description": "The lifecycle state of the survey."
                                                },
                                                "modality": {
                                                    "type": "string",
                                                    "description": "The voting modality of the survey."
                                                },
                                                "options": {
                                                    "type": "array",
                                                    "description": "The list of survey options."
                                                }
                                            },
                                            "description": "The survey data."
                                        },
                                        "tally": {
                                            "type": "object",
                                            "properties": {
                                                "mtime": {
                                                    "type": "integer",
                                                    "description": "Last modification time of the tally (milliseconds since epoch)."
                                                },
                                                "startTime": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "The start time of the tally period (milliseconds since epoch)."
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "description": "The status of the tally computation."
                                                },
                                                "total": {
                                                    "type": "integer",
                                                    "description": "Total number of votes."
                                                },
                                                "count": {
                                                    "type": "object",
                                                    "description": "Map from option ID to vote count."
                                                }
                                            },
                                            "description": "The vote tally."
                                        }
                                    },
                                    "required": [
                                        "orgId",
                                        "surveyId",
                                        "embedding",
                                        "survey",
                                        "tally"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad request (e.g., missing or invalid fields)"
                    },
                    "403": {
                        "description": "Forbidden (authentication required)"
                    },
                    "404": {
                        "description": "Organization or survey not found"
                    }
                }
            }
        }
    },
    "openapi": "3.0.3"
}