| 1 | # Copyright (C) 2025 AIDC-AI |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | # Unless required by applicable law or agreed to in writing, software |
| 8 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | # See the License for the specific language governing permissions and |
| 11 | # limitations under the License. |
| 12 | |
| 13 | """ |
| 14 | Resource discovery API schemas |
| 15 | """ |
| 16 | |
| 17 | from typing import List, Optional |
| 18 | from pydantic import BaseModel, Field |
| 19 | |
| 20 | |
| 21 | class WorkflowInfo(BaseModel): |
| 22 | """Workflow information""" |
| 23 | name: str = Field(..., description="Workflow filename") |
| 24 | display_name: str = Field(..., description="Display name with source info") |
| 25 | source: str = Field(..., description="Source (runninghub or selfhost)") |
| 26 | path: str = Field(..., description="Full path to workflow file") |
| 27 | key: str = Field(..., description="Workflow key (source/name)") |
| 28 | workflow_id: Optional[str] = Field(None, description="RunningHub workflow ID (if applicable)") |
| 29 | |
| 30 | |
| 31 | class WorkflowListResponse(BaseModel): |
| 32 | """Workflow list response""" |
| 33 | success: bool = True |
| 34 | message: str = "Success" |
| 35 | workflows: List[WorkflowInfo] = Field(..., description="List of available workflows") |
| 36 | |
| 37 | |
| 38 | class TemplateInfo(BaseModel): |
| 39 | """Template information""" |
| 40 | name: str = Field(..., description="Template filename") |
| 41 | display_name: str = Field(..., description="Display name") |
| 42 | size: str = Field(..., description="Size (e.g., 1080x1920)") |
| 43 | width: int = Field(..., description="Width in pixels") |
| 44 | height: int = Field(..., description="Height in pixels") |
| 45 | orientation: str = Field(..., description="Orientation (portrait/landscape/square)") |
| 46 | path: str = Field(..., description="Full path to template file") |
| 47 | key: str = Field(..., description="Template key (size/name)") |
| 48 | |
| 49 | |
| 50 | class TemplateListResponse(BaseModel): |
| 51 | """Template list response""" |
| 52 | success: bool = True |
| 53 | message: str = "Success" |
| 54 | templates: List[TemplateInfo] = Field(..., description="List of available templates") |
| 55 | |
| 56 | |
| 57 | class BGMInfo(BaseModel): |
| 58 | """BGM information""" |
| 59 | name: str = Field(..., description="BGM filename") |
| 60 | path: str = Field(..., description="Full path to BGM file") |
| 61 | source: str = Field(..., description="Source (default or custom)") |
| 62 | |
| 63 | |
| 64 | class BGMListResponse(BaseModel): |
| 65 | """BGM list response""" |
| 66 | success: bool = True |
| 67 | message: str = "Success" |
| 68 | bgm_files: List[BGMInfo] = Field(..., description="List of available BGM files") |
| 69 | |
| 70 |