{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/luckpanda-app/json-schema/luckpanda-app-update-legal-entity-command-schema.json",
  "title": "UpdateLegalEntityCommand",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/luckpanda-app-workspace-api-openapi.yml#/components/schemas/UpdateLegalEntityCommand",
  "allOf": [
    {
      "$ref": "#/$defs/VersionedCommand"
    },
    {
      "$ref": "#/$defs/LegalEntityFields"
    },
    {
      "type": "object",
      "properties": {
        "active": {
          "type": "boolean"
        }
      }
    }
  ],
  "$defs": {
    "CommandBase": {
      "type": "object",
      "required": [
        "idempotency_key",
        "correlation_id"
      ],
      "properties": {
        "idempotency_key": {
          "$ref": "#/$defs/IdempotencyKey"
        },
        "correlation_id": {
          "$ref": "#/$defs/Uuid"
        },
        "dry_run": {
          "type": "boolean",
          "default": false
        },
        "proposal_only": {
          "type": "boolean",
          "default": false,
          "description": "Make it a proposal for a person to accept instead of acting."
        },
        "approval_request_id": {
          "$ref": "#/$defs/Uuid"
        }
      }
    },
    "Currency": {
      "type": "string",
      "pattern": "^[A-Z]{3}$"
    },
    "IdempotencyKey": {
      "type": "string",
      "minLength": 16,
      "maxLength": 128,
      "pattern": "^[A-Za-z0-9._:-]+$"
    },
    "LegalEntityFields": {
      "type": "object",
      "properties": {
        "legal_name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 160
        },
        "tax_id": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 40
        },
        "country_code": {
          "type": "string",
          "pattern": "^[A-Z]{2}$"
        },
        "currency": {
          "$ref": "#/$defs/Currency"
        },
        "locale": {
          "type": "string",
          "maxLength": 35
        },
        "address": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "line1": {
              "type": [
                "string",
                "null"
              ]
            },
            "line2": {
              "type": [
                "string",
                "null"
              ]
            },
            "city": {
              "type": [
                "string",
                "null"
              ]
            },
            "state_code": {
              "type": [
                "string",
                "null"
              ]
            },
            "postal_code": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "additionalProperties": false
        },
        "is_default": {
          "type": "boolean"
        }
      }
    },
    "Uuid": {
      "type": "string",
      "format": "uuid"
    },
    "VersionedCommand": {
      "allOf": [
        {
          "$ref": "#/$defs/CommandBase"
        },
        {
          "type": "object",
          "required": [
            "expected_version"
          ],
          "properties": {
            "expected_version": {
              "type": "integer",
              "minimum": 1
            }
          }
        }
      ]
    }
  }
}