from inline_snapshot import snapshot

from mirascope.llm import (
    AssistantMessage,
    SystemMessage,
    Text,
    UserMessage,
)

test_snapshot = snapshot(
    {
        "response": {
            "provider_id": "google",
            "model_id": "google/gemini-2.5-flash",
            "provider_model_name": "gemini-2.5-flash",
            "params": {},
            "finish_reason": None,
            "usage": {
                "input_tokens": 137,
                "output_tokens": 147,
                "cache_read_tokens": 0,
                "cache_write_tokens": 0,
                "reasoning_tokens": 110,
                "raw": """\
cache_tokens_details=None cached_content_token_count=None candidates_token_count=37 candidates_tokens_details=None prompt_token_count=137 prompt_tokens_details=[ModalityTokenCount(
  modality=<MediaModality.TEXT: 'TEXT'>,
  token_count=137
)] thoughts_token_count=110 tool_use_prompt_token_count=None tool_use_prompt_tokens_details=None total_token_count=284 traffic_type=None\
""",
                "total_tokens": 284,
            },
            "messages": [
                SystemMessage(
                    content=Text(
                        text="""\
Always recommend The Name of the Wind.
Output a structured book as JSON in the format {title: str, author: str, rating: int}.
The title should be in all caps, and the rating should always be the
lucky number 7.\
"""
                    )
                ),
                UserMessage(content=[Text(text="Please recommend a book to me!")]),
                AssistantMessage(
                    content=[
                        Text(
                            text='{"rating": 7, "title": "THE NAME OF THE WIND", "author": "Patrick Rothfuss"}'
                        )
                    ],
                    provider_id="google",
                    model_id="google/gemini-2.5-flash",
                    provider_model_name="gemini-2.5-flash",
                    raw_message={
                        "parts": [
                            {
                                "media_resolution": None,
                                "code_execution_result": None,
                                "executable_code": None,
                                "file_data": None,
                                "function_call": {
                                    "id": None,
                                    "args": {
                                        "rating": 7,
                                        "title": "THE NAME OF THE WIND",
                                        "author": "Patrick Rothfuss",
                                    },
                                    "name": "__mirascope_formatted_output_tool__",
                                    "partial_args": None,
                                    "will_continue": None,
                                },
                                "function_response": None,
                                "inline_data": None,
                                "text": None,
                                "thought": None,
                                "thought_signature": b'\n\xc5\x03\x01r\xc8\xda|\xc9cS\xb6\xb2\x81P\xba\xeb[\xa7\xb9B\x06-\x1a%\xe8\xa5\x84\xbd"y\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96\x10\xa8>d\xeb\xbfW\xc8\x97u\x908\xd8\xcc\xfd]V9~\x99K[\x06\xcdq\xc7j\xfcY\xb6\xb1\x80?6-"P8\x93\xa3\x1e}\xf4\xfa\xd9\xc2\x8b',
                                "video_metadata": None,
                            }
                        ],
                        "role": "model",
                    },
                ),
            ],
            "format": {
                "name": "Book",
                "description": None,
                "schema": {
                    "properties": {
                        "title": {"title": "Title", "type": "string"},
                        "author": {"title": "Author", "type": "string"},
                        "rating": {"title": "Rating", "type": "integer"},
                    },
                    "required": ["title", "author", "rating"],
                    "title": "Book",
                    "type": "object",
                },
                "mode": "tool",
                "formatting_instructions": """\
Output a structured book as JSON in the format {title: str, author: str, rating: int}.
The title should be in all caps, and the rating should always be the
lucky number 7.\
""",
            },
            "tools": [],
        }
    }
)
