{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/restivity-ai/json-schema/restivity-ai-work-session-move-preview-schema.json",
  "title": "WorkSessionMovePreview",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/restivity-ai-openapi.json#/components/schemas/WorkSessionMovePreview",
  "type": "object",
  "properties": {
    "origin_workspace_id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
    },
    "destination_workspace_id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
    },
    "destination_project_id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
    },
    "owner_id": {
      "description": "Whose hours they are.",
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
    },
    "decides": {
      "description": "`alone`: the move runs at once. `approval`: it becomes a request to the owner/admins of the workspace the hours leave (`approvers`), only when the hours carry money of that workspace (a price or a cost): who loses money decides.",
      "type": "string",
      "enum": [
        "alone",
        "approval"
      ]
    },
    "decides_reason": {
      "description": "`no_amount_changes`: the caller decides alone because none of the sessions carries a price or a cost in the workspace they leave, so nobody loses money (`message` says so). Null on every other answer.",
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "no_amount_changes"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "message": {
      "description": "One sentence that says who decides and why, when the answer names a reason (`decides_reason`); null otherwise.",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "approvers": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name"
        ],
        "additionalProperties": false
      }
    },
    "origin_money": {
      "description": "What the caller reads of the origin’s money: rate and amount (owner/admin), the amount only (the hours’ owner when the workspace shows members their earnings), or nothing.",
      "type": "string",
      "enum": [
        "full",
        "amount",
        "none"
      ]
    },
    "destination_money": {
      "type": "string",
      "enum": [
        "full",
        "amount",
        "none"
      ]
    },
    "sessions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "session_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
          },
          "worked_seconds": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "movable": {
            "type": "boolean"
          },
          "reason": {
            "description": "Why the session cannot move: billed (on a draft) or invoiced.",
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "billed",
                  "invoiced"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "origin": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "rate_cents": {
                    "description": "The hourly rate, null when it is not the caller’s to read.",
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "amount_cents": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "currency": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "billing_status": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "rate_cents",
                  "amount_cents",
                  "currency",
                  "billing_status"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "destination": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "rate_cents": {
                    "description": "The hourly rate, null when it is not the caller’s to read.",
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "amount_cents": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "currency": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "billing_status": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "rate_cents",
                  "amount_cents",
                  "currency",
                  "billing_status"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "session_id",
          "worked_seconds",
          "movable",
          "reason",
          "origin",
          "destination"
        ],
        "additionalProperties": false
      }
    },
    "totals": {
      "type": "object",
      "properties": {
        "movable_seconds": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "frozen_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
          }
        },
        "origin": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "amount_cents": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "currency": {
                  "type": "string"
                }
              },
              "required": [
                "amount_cents",
                "currency"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "destination": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "amount_cents": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "currency": {
                  "type": "string"
                }
              },
              "required": [
                "amount_cents",
                "currency"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "movable_seconds",
        "frozen_ids",
        "origin",
        "destination"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "origin_workspace_id",
    "destination_workspace_id",
    "destination_project_id",
    "owner_id",
    "decides",
    "decides_reason",
    "message",
    "approvers",
    "origin_money",
    "destination_money",
    "sessions",
    "totals"
  ],
  "additionalProperties": false
}