# Copyright [2025] [IBM]
# Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
# See the LICENSE file in the project root for license information.

from pydantic import BaseModel
from pydantic import Field
from app.shared.models import BaseResponseModel


class CreateAssetFromSqlQueryRequest(BaseModel):
    """Request model for creating asset from SQL query."""

    container_id_or_name: str = Field(
        ...,
        description="UUID or name of the container where the asset will be created.",
    )
    container_type: str = Field(
        ...,
        description='Type of the container, either "catalog" or "project".',
    )
    connection_id_or_name: str = Field(
        ...,
        description="UUID or name of the connection to associate with the SQL query.",
    )
    sql_query: str = Field(
        ..., description="The SQL query generated by the 'generate_sql' agent."
    )
    asset_name: str | None = Field(
        None, description="Optional custom name for the created asset. If not provided, a timestamp-based name will be generated."
    )


class CreateAssetFromSqlQueryResponse(BaseResponseModel):
    asset_url: str = Field(..., description="An URL of the newly created asset.")
