{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/akeda-ru/json-schema/akeda-ru-core-contact-merge-result-schema.json",
  "title": "CoreContactMergeResult",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/akeda-ru-core-contacts-api-openapi.yml#/components/schemas/CoreContactMergeResult",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "preview": {
      "type": "boolean",
      "description": "Только предпросмотр"
    },
    "source_id": {
      "type": "string",
      "description": "Карточка-источник"
    },
    "source_name": {
      "type": "string",
      "description": "Имя источника"
    },
    "target_id": {
      "type": "string",
      "description": "Целевая карточка"
    },
    "target_name": {
      "type": "string",
      "description": "Имя цели"
    },
    "documents": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CoreContactMergeDocument"
      },
      "description": "Документы со ссылкой на источник"
    },
    "holders": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CoreContactMergeHolder"
      },
      "description": "Таблицы со ссылкой на источник"
    },
    "totals": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CoreContactMergeTotal"
      },
      "description": "Итоги регистров до и после"
    },
    "employee_moved": {
      "type": "boolean",
      "description": "Привязка к сотруднику перенесена. Переносится только на физлицо; при объединении в ИП или организацию остаётся у архивной карточки"
    },
    "archived": {
      "type": "boolean",
      "description": "Источник в архиве"
    }
  },
  "$defs": {
    "CoreContactMergeDocument": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "description": "Документ"
        },
        "number": {
          "type": "string",
          "description": "Номер"
        },
        "type_key": {
          "type": "string",
          "description": "Вид документа"
        },
        "date": {
          "type": "string",
          "description": "Дата"
        },
        "status": {
          "type": "string",
          "description": "Статус"
        }
      }
    },
    "CoreContactMergeHolder": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "table": {
          "type": "string",
          "description": "Таблица"
        },
        "column": {
          "type": "string",
          "description": "Колонка"
        },
        "rows": {
          "type": "integer",
          "description": "Строк с карточкой-источником"
        }
      }
    },
    "CoreContactMergeTotal": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "register": {
          "type": "string",
          "description": "Регистр"
        },
        "value": {
          "type": "string",
          "description": "Значение регистра"
        },
        "before": {
          "type": "string",
          "description": "Сумма по обеим карточкам до"
        },
        "after": {
          "type": "string",
          "description": "Итог у цели после"
        }
      }
    }
  }
}