# Define response wrapper models
class PetsResponse(BaseModel):
    """A response containing a list of pets"""
    pets: List[Pet] = Field(..., description="List of pets")

class OwnersResponse(BaseModel):
    """A response containing a list of owners"""
    owners: List[Owner] = Field(..., description="List of owners")

def construct_base_open_api() -> OpenAPI:
    return OpenAPI(
        openapi="3.1.0",
        info=Info(title="Pet Sitter API", version="0.0.1"),
        servers=[{"url": "http://127.0.0.1:4010", "description": "Local prism server"}],
        paths={
            # GET and POST endpoints for pets collection
            "/pets": PathItem(
                get=Operation(
                    operationId="listPets",
                    description="List all pets",
                    responses={
                        "200": {
                            "description": "A list of pets",
                            "content": {
                                "application/json": {
                                    "schema": PydanticSchema(schema_class=PetsResponse)
                                }
                            },
                        }
                    },
                ),
                post=Operation(
                    operationId="createPet",
                    description="Create a pet",
                    requestBody={
                        "content": {
                            "application/json": {"schema": PydanticSchema(schema_class=Pet)}
                        }
                    },
                    responses={
                        "201": {
                            "description": "Pet created",
                            "content": {
                                "application/json": {"schema": PydanticSchema(schema_class=Pet)}
                            },
                        }
                    },
                ),
            ),
            # GET endpoint for a specific pet by ID
            "/pets/{pet_id}": PathItem(
                get=Operation(
                    operationId="getPetById",
                    description="Get a pet by ID",
                    parameters=[
                        {
                            "name": "pet_id",
                            "in": "path",
                            "description": "ID of pet to return",
                            "required": True,
                            "schema": {"type": "integer", "format": "int64"},
                            "examples": {"1": {"value": 1}},
                        },
                    ],
                    responses={
                        "200": {
                            "description": "A pet",
                            "content": {
                                "application/json": {"schema": PydanticSchema(schema_class=Pet)}
                            },
                        }
                    },
                ),
            ),
            # GET endpoint for owners collection
            "/owners": PathItem(
                get=Operation(
                    operationId="listOwners",
                    description="List all owners",
                    responses={
                        "200": {
                            "description": "A list of owners",
                            "content": {
                                "application/json": {
                                    "schema": PydanticSchema(schema_class=OwnersResponse)
                                }
                            },
                        }
                    },
                ),
            ),
        },
    )