{
  "openapi": "3.1.0",
  "info": {
    "title": "TMGT API examples",
    "version": "1.0.0-examples",
    "description": "Request and response examples for the local integration clients."
  },
  "servers": [
    {
      "url": "https://example.invalid",
      "description": "Reserved invalid example domain; not an API server. Do not send requests."
    }
  ],
  "paths": {
    "/examples/v1/wallets": {
      "post": {
        "operationId": "create-wallet",
        "summary": "Создать тестовый кошелек",
        "description": "Структура запроса на создание кошелька и связь с инициатором.",
        "tags": [
          "Кошельки"
        ],
        "responses": {
          "200": {
            "description": "Иллюстративный локальный результат",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "owner_id": {
                      "type": "string"
                    },
                    "network": {
                      "type": "string"
                    },
                    "address": {
                      "type": "string"
                    },
                    "asset": {
                      "type": "string"
                    },
                    "balance": {
                      "type": "string"
                    },
                    "sample_only": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "owner_id",
                    "network",
                    "address",
                    "asset",
                    "balance",
                    "sample_only"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "id": "example_wallet_001",
                  "owner_id": "example_user_001",
                  "network": "example_network",
                  "address": "example_address_001",
                  "asset": "example_asset",
                  "balance": "100.00",
                  "sample_only": true
                }
              }
            }
          },
          "400": {
            "description": "Ошибка локального сценария; рабочая модель ошибок еще не задана."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "owner_id": {
                    "type": "string"
                  },
                  "network": {
                    "type": "string"
                  }
                },
                "required": [
                  "owner_id",
                  "network"
                ],
                "additionalProperties": false
              },
              "example": {
                "owner_id": "example_user_001",
                "network": "example_network"
              }
            }
          }
        }
      }
    },
    "/examples/v1/wallets/{wallet_id}": {
      "get": {
        "operationId": "get-wallet",
        "summary": "Прочитать тестовый кошелек",
        "description": "Запрос сведений о кошельке по его идентификатору.",
        "tags": [
          "Кошельки"
        ],
        "responses": {
          "200": {
            "description": "Иллюстративный локальный результат",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "owner_id": {
                      "type": "string"
                    },
                    "network": {
                      "type": "string"
                    },
                    "address": {
                      "type": "string"
                    },
                    "asset": {
                      "type": "string"
                    },
                    "balance": {
                      "type": "string"
                    },
                    "sample_only": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "owner_id",
                    "network",
                    "address",
                    "asset",
                    "balance",
                    "sample_only"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "id": "example_wallet_001",
                  "owner_id": "example_user_001",
                  "network": "example_network",
                  "address": "example_address_001",
                  "asset": "example_asset",
                  "balance": "100.00",
                  "sample_only": true
                }
              }
            }
          },
          "400": {
            "description": "Ошибка локального сценария; рабочая модель ошибок еще не задана."
          }
        },
        "parameters": [
          {
            "name": "wallet_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "example_wallet_001"
          }
        ]
      }
    },
    "/examples/v1/auth/sessions": {
      "post": {
        "operationId": "create-session",
        "summary": "Создать тестовую сессию",
        "description": "Параметры сессии и идентификатор инициатора.",
        "tags": [
          "Доступ"
        ],
        "responses": {
          "200": {
            "description": "Иллюстративный локальный результат",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "actor_id": {
                      "type": "string"
                    },
                    "authenticated": {
                      "type": "boolean"
                    },
                    "sample_only": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "actor_id",
                    "authenticated",
                    "sample_only"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "id": "example_session_001",
                  "actor_id": "example_user_001",
                  "authenticated": false,
                  "sample_only": true
                }
              }
            }
          },
          "400": {
            "description": "Ошибка локального сценария; рабочая модель ошибок еще не задана."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "actor_id": {
                    "type": "string"
                  }
                },
                "required": [
                  "actor_id"
                ],
                "additionalProperties": false
              },
              "example": {
                "actor_id": "example_user_001"
              }
            }
          }
        }
      }
    },
    "/examples/v1/gas/budgets": {
      "post": {
        "operationId": "create-gas-budget",
        "summary": "Задать пример бюджета",
        "description": "Лимит расходов и параметры бюджета сетевых комиссий.",
        "tags": [
          "Gas"
        ],
        "responses": {
          "200": {
            "description": "Иллюстративный локальный результат",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "project_id": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "limit": {
                      "type": "string"
                    },
                    "spent": {
                      "type": "string"
                    },
                    "sample_only": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "project_id",
                    "currency",
                    "limit",
                    "spent",
                    "sample_only"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "id": "example_budget_001",
                  "project_id": "example_project_001",
                  "currency": "USD",
                  "limit": "25.00",
                  "spent": "0.00",
                  "sample_only": true
                }
              }
            }
          },
          "400": {
            "description": "Ошибка локального сценария; рабочая модель ошибок еще не задана."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "project_id": {
                    "type": "string"
                  },
                  "currency": {
                    "type": "string"
                  },
                  "limit": {
                    "type": "string"
                  }
                },
                "required": [
                  "project_id",
                  "currency",
                  "limit"
                ],
                "additionalProperties": false
              },
              "example": {
                "project_id": "example_project_001",
                "currency": "USD",
                "limit": "25.00"
              }
            }
          }
        }
      }
    },
    "/examples/v1/policies": {
      "post": {
        "operationId": "create-policy",
        "summary": "Задать тестовый лимит",
        "description": "Параметры лимита суммы в политике.",
        "tags": [
          "Политики"
        ],
        "responses": {
          "200": {
            "description": "Иллюстративный локальный результат",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    },
                    "max_amount": {
                      "type": "string"
                    },
                    "asset": {
                      "type": "string"
                    },
                    "sample_only": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "version",
                    "max_amount",
                    "asset",
                    "sample_only"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "id": "example_policy_001",
                  "version": 1,
                  "max_amount": "100.00",
                  "asset": "example_asset",
                  "sample_only": true
                }
              }
            }
          },
          "400": {
            "description": "Ошибка локального сценария; рабочая модель ошибок еще не задана."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "max_amount": {
                    "type": "string"
                  },
                  "asset": {
                    "type": "string"
                  }
                },
                "required": [
                  "max_amount",
                  "asset"
                ],
                "additionalProperties": false
              },
              "example": {
                "max_amount": "100.00",
                "asset": "example_asset"
              }
            }
          }
        }
      }
    },
    "/examples/v1/intents": {
      "post": {
        "operationId": "create-intent",
        "summary": "Создать намерение",
        "description": "Кошелек, получатель, сумма и ключ идемпотентности запроса.",
        "tags": [
          "Операции"
        ],
        "responses": {
          "200": {
            "description": "Иллюстративный локальный результат",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "sample_only": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "sample_only"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "id": "example_intent_001",
                  "status": "created",
                  "sample_only": true
                }
              }
            }
          },
          "400": {
            "description": "Ошибка локального сценария; рабочая модель ошибок еще не задана."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "request_id": {
                    "type": "string"
                  },
                  "wallet_id": {
                    "type": "string"
                  },
                  "recipient": {
                    "type": "string"
                  },
                  "asset": {
                    "type": "string"
                  },
                  "amount": {
                    "type": "string"
                  }
                },
                "required": [
                  "request_id",
                  "wallet_id",
                  "recipient",
                  "asset",
                  "amount"
                ],
                "additionalProperties": false
              },
              "example": {
                "request_id": "example_request_001",
                "wallet_id": "example_wallet_001",
                "recipient": "example_recipient_001",
                "asset": "example_asset",
                "amount": "10.00"
              }
            }
          }
        }
      }
    },
    "/examples/v1/intents/{intent_id}/simulation": {
      "post": {
        "operationId": "simulate-intent",
        "summary": "Рассчитать пример эффекта",
        "description": "Ожидаемое изменение баланса и комиссии в сценарии.",
        "tags": [
          "Операции"
        ],
        "responses": {
          "200": {
            "description": "Иллюстративный локальный результат",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "intent_id": {
                      "type": "string"
                    },
                    "effect": {
                      "type": "object",
                      "properties": {
                        "balance_before": {
                          "type": "string"
                        },
                        "balance_after": {
                          "type": "string"
                        },
                        "asset": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "balance_before",
                        "balance_after",
                        "asset"
                      ],
                      "additionalProperties": false
                    },
                    "network_state_sample_only": {
                      "type": "boolean"
                    },
                    "sample_only": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "intent_id",
                    "effect",
                    "network_state_sample_only",
                    "sample_only"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "intent_id": "example_intent_001",
                  "effect": {
                    "balance_before": "100.00",
                    "balance_after": "90.00",
                    "asset": "example_asset"
                  },
                  "network_state_sample_only": true,
                  "sample_only": true
                }
              }
            }
          },
          "400": {
            "description": "Ошибка локального сценария; рабочая модель ошибок еще не задана."
          }
        },
        "parameters": [
          {
            "name": "intent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "example_intent_001"
          }
        ]
      }
    },
    "/examples/v1/intents/{intent_id}/evaluation": {
      "post": {
        "operationId": "evaluate-intent",
        "summary": "Проверить тестовую политику",
        "description": "Условия политики и основания решения о допуске.",
        "tags": [
          "Операции"
        ],
        "responses": {
          "200": {
            "description": "Иллюстративный локальный результат",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "intent_id": {
                      "type": "string"
                    },
                    "decision": {
                      "type": "string"
                    },
                    "policy_version": {
                      "type": "integer"
                    },
                    "reasons": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "t1_status": {
                      "type": "string"
                    },
                    "sample_only": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "intent_id",
                    "decision",
                    "policy_version",
                    "reasons",
                    "t1_status",
                    "sample_only"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "intent_id": "example_intent_001",
                  "decision": "allow",
                  "policy_version": 1,
                  "reasons": [],
                  "t1_status": "illustrative_not_scored",
                  "sample_only": true
                }
              }
            }
          },
          "400": {
            "description": "Ошибка локального сценария; рабочая модель ошибок еще не задана."
          }
        },
        "parameters": [
          {
            "name": "intent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "example_intent_001"
          }
        ]
      }
    },
    "/examples/v1/intents/{intent_id}/execution": {
      "post": {
        "operationId": "execute-intent",
        "summary": "Завершить локальный сценарий",
        "description": "Переход состояния после положительного решения.",
        "tags": [
          "Операции"
        ],
        "responses": {
          "200": {
            "description": "Иллюстративный локальный результат",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "intent_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "cryptography_performed": {
                      "type": "boolean"
                    },
                    "signature": {
                      "type": "null"
                    },
                    "network_transaction": {
                      "type": "null"
                    },
                    "sample_only": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "intent_id",
                    "status",
                    "cryptography_performed",
                    "signature",
                    "network_transaction",
                    "sample_only"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "intent_id": "example_intent_001",
                  "status": "example_completed",
                  "cryptography_performed": false,
                  "signature": null,
                  "network_transaction": null,
                  "sample_only": true
                }
              }
            }
          },
          "400": {
            "description": "Ошибка локального сценария; рабочая модель ошибок еще не задана."
          }
        },
        "parameters": [
          {
            "name": "intent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "example_intent_001"
          }
        ]
      }
    },
    "/examples/v1/events": {
      "get": {
        "operationId": "list-events",
        "summary": "Прочитать локальные события",
        "description": "Структура ленты событий операций.",
        "tags": [
          "События"
        ],
        "responses": {
          "200": {
            "description": "Иллюстративный локальный результат",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "intent_id": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "sample_only": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "intent_id",
                          "type",
                          "sample_only"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "sample_only": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "items",
                    "sample_only"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "items": [
                    {
                      "id": "example_event_001",
                      "intent_id": "example_intent_001",
                      "type": "example.intent.evaluated",
                      "sample_only": true
                    }
                  ],
                  "sample_only": true
                }
              }
            }
          },
          "400": {
            "description": "Ошибка локального сценария; рабочая модель ошибок еще не задана."
          }
        }
      }
    }
  },
  "x-local-only": true,
  "x-not-production": true,
  "x-qualified-custody": false
}
