{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/voltplan-app/json-schema/voltplan-app-admin-component-patch-schema.json",
  "title": "AdminComponentPatch",
  "description": "Partial update; only keys present are written. Any other key is ignored.",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/voltplan-app-openapi.json#/components/schemas/AdminComponentPatch",
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "Component type: battery, charger, inverter, transformer, load, power, fuse, shunt, switch, disconnect, bridge or tool; `\"\"` when unset."
    },
    "description": {
      "type": "string"
    },
    "image": {
      "type": "string"
    },
    "icon": {
      "type": "string"
    },
    "watt": {
      "type": [
        "number",
        "null"
      ]
    },
    "voltage_in": {
      "type": [
        "number",
        "null"
      ]
    },
    "voltage_in_type": {
      "type": "string",
      "description": "`ac`, `dc`, or `\"\"` when unset."
    },
    "voltage_out": {
      "type": [
        "number",
        "null"
      ]
    },
    "voltage_out_type": {
      "type": "string",
      "description": "`ac`, `dc`, or `\"\"` when unset."
    },
    "estd_price_euro": {
      "type": [
        "number",
        "null"
      ]
    },
    "duty_cycle": {
      "type": [
        "number",
        "null"
      ],
      "description": "Share of time a load cycles on. Percentage 0–100."
    },
    "default_utilization_factor": {
      "type": [
        "number",
        "null"
      ],
      "description": "Default share of time a load is used. Percentage 0–100."
    },
    "usage_hours_per_day": {
      "type": [
        "number",
        "null"
      ]
    },
    "amperage": {
      "type": [
        "number",
        "null"
      ]
    },
    "cutoff_voltage": {
      "type": [
        "number",
        "null"
      ]
    },
    "fuse_type": {
      "type": "string"
    },
    "wire_gauge": {
      "type": "string"
    },
    "preferred_suggestion": {
      "type": "boolean"
    },
    "published": {
      "type": "boolean",
      "description": "`true` runs the publication gate described on the operation."
    },
    "published_at": {
      "type": "string",
      "description": "PocketBase datetime; set to now on first publication when empty."
    },
    "slug": {
      "type": "string",
      "maxLength": 120,
      "pattern": "^$|^[a-z0-9]+(?:-[a-z0-9]+)*$",
      "description": "Public URL segment of /components/<slug>; unique among non-empty values."
    },
    "summary": {
      "type": "string",
      "maxLength": 400,
      "description": "Lead paragraph of the public page."
    },
    "safety_notes": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      },
      "description": "Wiring hazards shown in the amber callout of the public page."
    },
    "specs": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/AdminComponentSpecRow"
      },
      "description": "Technical-data table of the public page."
    },
    "downloads": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/AdminComponentDownload"
      },
      "description": "Datasheets and manuals."
    },
    "works_with": {
      "type": "array",
      "maxItems": 12,
      "items": {
        "type": "string"
      },
      "description": "Ids of curated companion components."
    },
    "works_with_notes": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": "string"
      },
      "description": "Component id → short pairing note."
    },
    "capacity_wh": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0,
      "description": "Stored energy of a power station in Wh. Override; 0/null = derived from the electrical columns or `specs`."
    },
    "chemistry": {
      "type": "string",
      "enum": [
        "lifepo4",
        "li-ion",
        "agm",
        "gel",
        "lead_acid",
        ""
      ],
      "description": "Cell chemistry of a battery or power station; `\"\"` = derived."
    },
    "cycle_life": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0,
      "description": "Rated cycles. Override; 0/null = derived from the electrical columns or `specs`."
    },
    "weight_kg": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0,
      "description": "Net weight in kg. Override; 0/null = derived from the electrical columns or `specs`."
    },
    "max_charge_a": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0,
      "description": "Battery BMS continuous charge current in A. Override; 0/null = derived from the electrical columns or `specs`."
    },
    "max_discharge_a": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0,
      "description": "Battery BMS continuous discharge current in A. Override; 0/null = derived from the electrical columns or `specs`."
    },
    "charge_current_a": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0,
      "description": "Rated output current of a charger or inverter-charger in A. Override; 0/null = derived from the electrical columns or `specs`."
    },
    "pv_voc_max": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0,
      "description": "Highest PV open-circuit voltage of an MPPT in V. Override; 0/null = derived from the electrical columns or `specs`."
    },
    "efficiency_pct": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0,
      "description": "Peak conversion efficiency in %. Override; 0/null = derived from the electrical columns or `specs`.",
      "maximum": 100
    },
    "brand": {
      "type": [
        "string",
        "null"
      ],
      "description": "Brand name, matched or created in `component_brands`; empty or non-string clears the brand."
    },
    "affiliate_links": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AdminComponentAffiliateLinkInput"
      },
      "description": "Complete desired link set; stored links missing here are deleted."
    }
  },
  "$defs": {
    "AdminComponentAffiliateLinkInput": {
      "type": "object",
      "description": "Desired affiliate link. Without `id` it is created; entries without `url` or `country` are skipped.",
      "properties": {
        "id": {
          "type": "string",
          "description": "Id of an existing `affiliate_links` record to update."
        },
        "url": {
          "type": "string"
        },
        "country": {
          "type": "string",
          "enum": [
            "universal",
            "de",
            "us",
            "uk",
            "fr",
            "es",
            "it",
            "au"
          ]
        }
      }
    },
    "AdminComponentDownload": {
      "type": "object",
      "description": "A datasheet or manual link.",
      "additionalProperties": false,
      "required": [
        "ext",
        "name",
        "url"
      ],
      "properties": {
        "ext": {
          "type": "string",
          "description": "Badge text, e.g. `PDF`."
        },
        "name": {
          "type": "string"
        },
        "meta": {
          "type": "string",
          "description": "E.g. `1.2 MB · rev. 2026-03`."
        },
        "url": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "AdminComponentSpecRow": {
      "type": "object",
      "description": "One row of the technical-data table.",
      "additionalProperties": false,
      "required": [
        "k",
        "v"
      ],
      "properties": {
        "k": {
          "type": "string",
          "maxLength": 80
        },
        "v": {
          "type": "string",
          "maxLength": 160
        }
      }
    }
  }
}