{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/lassare-com/json-schema/lassare-com-company-settings-schema.json",
  "title": "CompanySettings",
  "description": "Company-level configuration settings.\n\nPhase 3 (MVP): Minimal version with default_timezone and default_channels.\nPhase 4 (T068): Extended with escalation_policy fields.",
  "x-generated": "2026-11-15",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/lassare-com-openapi.json#/components/schemas/CompanySettings",
  "properties": {
    "companyId": {
      "type": "string",
      "title": "Companyid"
    },
    "defaultChannels": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Defaultchannels",
      "description": "Default notification channels: e.g. ['slack', 'email']"
    },
    "defaultTimezone": {
      "type": "string",
      "title": "Defaulttimezone",
      "description": "IANA timezone for timestamp display: e.g. 'Europe/Rome', 'America/New_York'"
    },
    "createdAt": {
      "type": "string",
      "title": "Createdat",
      "description": "ISO 8601 timestamp"
    },
    "updatedAt": {
      "type": "string",
      "title": "Updatedat",
      "description": "ISO 8601 timestamp"
    },
    "defaultEscalationPolicy": {
      "anyOf": [
        {
          "$ref": "#/$defs/EscalationPolicy"
        },
        {
          "type": "null"
        }
      ],
      "description": "T068: Escalation policy with secondary_approver and urgency_overrides (FR-012)"
    },
    "defaultLanguage": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Defaultlanguage",
      "description": "Phase 2+: Company language preference: e.g. 'en-US', 'it-IT', 'es-MX'"
    },
    "logVerbosity": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Logverbosity",
      "description": "Log verbosity level: 'minimal' (errors only), 'standard' (default), 'verbose' (full debug). Set by Lassare ops via Admin backend."
    }
  },
  "type": "object",
  "required": [
    "companyId",
    "defaultChannels",
    "defaultTimezone",
    "createdAt",
    "updatedAt"
  ],
  "$defs": {
    "EscalationPolicy": {
      "properties": {
        "secondaryApprover": {
          "anyOf": [
            {
              "$ref": "#/$defs/SecondaryApprover"
            },
            {
              "type": "null"
            }
          ],
          "description": "Default secondary approver for escalations"
        },
        "urgencyOverrides": {
          "anyOf": [
            {
              "additionalProperties": {
                "$ref": "#/$defs/UrgencyTimingProfile"
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Urgencyoverrides",
          "description": "Custom timing profiles for urgency levels (overrides system defaults)"
        }
      },
      "type": "object",
      "title": "EscalationPolicy",
      "description": "Escalation policy configuration.\n\nDefines:\n- secondary_approver: Who to escalate to when primary approvers don't respond\n- urgency_overrides: Custom timing profiles for urgency levels\n\nUsed in CompanySettings and ProjectSettings with precedence:\n1. Request-level fallback_approver (highest)\n2. ProjectSettings.escalation_policy\n3. CompanySettings.escalation_policy\n4. System defaults (lowest)"
    },
    "SecondaryApprover": {
      "properties": {
        "approverType": {
          "allOf": [
            {
              "$ref": "#/$defs/SecondaryApproverType"
            }
          ],
          "description": "Type of secondary approver"
        },
        "approverValue": {
          "type": "string",
          "title": "Approvervalue",
          "description": "Approver identifier (email, channel ID, or user ID)"
        }
      },
      "type": "object",
      "required": [
        "approverType",
        "approverValue"
      ],
      "title": "SecondaryApprover",
      "description": "Secondary approver configuration.\n\nFormat: type:value\n- email:admin@company.com\n- slack:C1234567890 (channel)\n- slack_user:U1234567890 (DM)"
    },
    "SecondaryApproverType": {
      "type": "string",
      "enum": [
        "email",
        "slack",
        "slack_user",
        "webhook"
      ],
      "title": "SecondaryApproverType",
      "description": "Secondary approver target types."
    },
    "UrgencyTimingProfile": {
      "properties": {
        "reminderMinutes": {
          "type": "integer",
          "title": "Reminderminutes",
          "description": "Minutes until reminder notification (from T=0)"
        },
        "escalationMinutes": {
          "type": "integer",
          "title": "Escalationminutes",
          "description": "Minutes until escalation to secondary approver (from T=0)"
        },
        "expiryMinutes": {
          "type": "integer",
          "title": "Expiryminutes",
          "description": "Minutes until request expires (from T=0)"
        }
      },
      "type": "object",
      "required": [
        "reminderMinutes",
        "escalationMinutes",
        "expiryMinutes"
      ],
      "title": "UrgencyTimingProfile",
      "description": "Timing configuration for a specific urgency level.\n\nDefines reminder_minutes, escalation_minutes, and expiry_minutes\nfrom initial notification time (T=0)."
    }
  }
}