{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cayra-io/json-schema/cayra-io-license-create-request-schema.json",
  "title": "LicenseCreateRequest",
  "description": "Request model for creating a new license",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cayra-io-openapi.json#/components/schemas/LicenseCreateRequest",
  "properties": {
    "customer_id": {
      "type": "string",
      "maxLength": 128,
      "minLength": 3,
      "title": "Customer Id",
      "description": "Customer identifier (3-128 chars, alphanumeric + _ or -)"
    },
    "customer_name": {
      "type": "string",
      "maxLength": 255,
      "minLength": 1,
      "title": "Customer Name",
      "description": "Customer full name"
    },
    "customer_email": {
      "type": "string",
      "format": "email",
      "title": "Customer Email",
      "description": "Customer contact email"
    },
    "customer_company": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 255
        },
        {
          "type": "null"
        }
      ],
      "title": "Customer Company",
      "description": "Company name"
    },
    "license_type": {
      "allOf": [
        {
          "$ref": "#/$defs/LicenseTypeEnum"
        }
      ],
      "description": "Type of license"
    },
    "product_version": {
      "type": "string",
      "title": "Product Version",
      "description": "Product version"
    },
    "expires_in_days": {
      "type": "integer",
      "maximum": 3650.0,
      "minimum": 1.0,
      "title": "Expires In Days",
      "description": "License validity period (1-3650 days)",
      "default": 365
    },
    "max_activations": {
      "type": "integer",
      "maximum": 1.0,
      "minimum": 1.0,
      "title": "Max Activations",
      "description": "Maximum number of activations allowed (fixed to 1)",
      "default": 1
    },
    "features": {
      "type": "object",
      "title": "Features",
      "description": "Feature flags"
    },
    "limits": {
      "type": "object",
      "title": "Limits",
      "description": "Usage limits"
    },
    "notes": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 1000
        },
        {
          "type": "null"
        }
      ],
      "title": "Notes",
      "description": "Internal notes"
    },
    "company_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Company Id",
      "description": "Target company UUID. When omitted the first company of the customer is used."
    },
    "claude_api_key": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Claude Api Key",
      "description": "Optional Claude API key to store alongside the license"
    },
    "openai_api_key": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Openai Api Key",
      "description": "Optional OpenAI API key to store alongside the license"
    }
  },
  "type": "object",
  "required": [
    "customer_id",
    "customer_name",
    "customer_email",
    "license_type",
    "product_version"
  ],
  "$defs": {
    "LicenseTypeEnum": {
      "type": "string",
      "enum": [
        "installation",
        "update",
        "trial"
      ],
      "title": "LicenseTypeEnum",
      "description": "License type enumeration"
    }
  }
}