{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/companydata-dk/json-schema/companydata-dk-production-unit-response-schema.json",
  "title": "ProductionUnitResponse",
  "description": "Response for single production unit lookup.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/companydata-dk-production-units-api-openapi.yml#/components/schemas/ProductionUnitResponse",
  "properties": {
    "data": {
      "$ref": "#/$defs/ProductionUnit",
      "description": "Full production unit details"
    },
    "company_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Company Name",
      "description": "Parent company name for context"
    },
    "meta": {
      "additionalProperties": true,
      "type": "object",
      "title": "Meta",
      "description": "Response metadata"
    }
  },
  "type": "object",
  "required": [
    "data"
  ],
  "$defs": {
    "CompanyAddress": {
      "properties": {
        "address_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Address Id",
          "description": "DAWA adgangsadresse ID for direct geocoding lookup"
        },
        "street_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Street Name",
          "description": "Street name (vejnavn)"
        },
        "street_code": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Street Code",
          "description": "Street code, unique per municipality (vejkode)"
        },
        "house_number": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "House Number",
          "description": "House number (husnummerFra)"
        },
        "house_number_to": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "House Number To",
          "description": "House number end for address ranges"
        },
        "house_letter": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "House Letter",
          "description": "Letter suffix, e.g. 'A', 'B'"
        },
        "house_letter_to": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "House Letter To",
          "description": "Letter suffix end for ranges"
        },
        "floor": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Floor",
          "description": "Floor (etage), e.g. 'st', '1', '2'"
        },
        "door": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Door",
          "description": "Door identifier: 'th' (right), 'tv' (left), 'mf' (middle)"
        },
        "postal_code": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Postal Code",
          "description": "4-digit Danish postal code"
        },
        "postal_district": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Postal District",
          "description": "Postal district name"
        },
        "town_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Town Name",
          "description": "Town name for rural areas (bynavn)"
        },
        "care_of": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Care Of",
          "description": "c/o name if applicable"
        },
        "po_box": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Po Box",
          "description": "P.O. box number"
        },
        "free_text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Free Text",
          "description": "Free text address (typically for foreign addresses)"
        },
        "country_code": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Country Code",
          "description": "ISO 3166-1 alpha-2 country code",
          "default": "DK"
        },
        "municipality_code": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Municipality Code",
          "description": "3-digit Danish municipality code"
        },
        "municipality_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Municipality Name",
          "description": "Municipality name"
        },
        "street": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Street",
          "description": "Formatted street address for display"
        },
        "city": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "City",
          "description": "City name (same as postal_district)"
        }
      },
      "type": "object",
      "title": "CompanyAddress",
      "description": "Danish address with all CVR fields preserved for accurate geocoding."
    },
    "CompanyEmployees": {
      "properties": {
        "count": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Count",
          "description": "Exact employee count (if available)"
        },
        "interval": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Interval",
          "description": "Employee count interval"
        },
        "full_time_equivalent": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Full Time Equivalent",
          "description": "Full-time equivalent (FTE) count"
        },
        "including_owners": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Including Owners",
          "description": "Employee count including owners"
        },
        "year": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Year",
          "description": "Year the employee data was reported"
        },
        "month": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Month",
          "description": "Month of the figure (monthly series only)"
        }
      },
      "type": "object",
      "title": "CompanyEmployees",
      "description": "Employee count information from CVR."
    },
    "CompanyIndustry": {
      "properties": {
        "primary_code": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Primary Code",
          "description": "Primary 6-digit industry code (DB07)"
        },
        "primary_text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Primary Text",
          "description": "Primary industry description"
        },
        "secondary": {
          "items": {
            "$ref": "#/$defs/SecondaryIndustry"
          },
          "type": "array",
          "title": "Secondary",
          "description": "List of secondary industry codes"
        }
      },
      "type": "object",
      "title": "CompanyIndustry",
      "description": "Industry classification using Danish DB07 codes."
    },
    "CvrContact": {
      "properties": {
        "phone": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Phone",
          "description": "Phone number"
        },
        "email": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Email",
          "description": "Email address"
        },
        "website": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Website",
          "description": "Website URL"
        },
        "fax": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Fax",
          "description": "Fax number"
        }
      },
      "type": "object",
      "title": "CvrContact",
      "description": "Contact information as registered in CVR (adds the fax number, which\na claimed profile cannot set)."
    },
    "ProductionUnit": {
      "properties": {
        "p_number": {
          "type": "string",
          "title": "P Number",
          "description": "10-digit P-nummer (unique production unit identifier)"
        },
        "cvr": {
          "type": "string",
          "title": "Cvr",
          "description": "CVR number of parent company"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Name",
          "description": "Production unit name/description"
        },
        "status": {
          "type": "string",
          "title": "Status",
          "description": "Unit status",
          "default": "active"
        },
        "is_main_unit": {
          "type": "boolean",
          "title": "Is Main Unit",
          "description": "Whether this is the main unit (hovedafdeling)",
          "default": false
        },
        "valid_from": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Valid From",
          "description": "Date P-enhed was created"
        },
        "valid_to": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Valid To",
          "description": "Date P-enhed was dissolved (null = active)"
        },
        "address": {
          "anyOf": [
            {
              "$ref": "#/$defs/CompanyAddress"
            },
            {
              "type": "null"
            }
          ],
          "description": "Physical location address"
        },
        "location": {
          "anyOf": [
            {
              "$ref": "#/$defs/app__models__company__GeoLocation"
            },
            {
              "type": "null"
            }
          ],
          "description": "Geocoded coordinates"
        },
        "industry": {
          "anyOf": [
            {
              "$ref": "#/$defs/CompanyIndustry"
            },
            {
              "type": "null"
            }
          ],
          "description": "Industry classification (may differ from parent)"
        },
        "employees": {
          "anyOf": [
            {
              "$ref": "#/$defs/CompanyEmployees"
            },
            {
              "type": "null"
            }
          ],
          "description": "Employee count at this location"
        },
        "employees_monthly": {
          "anyOf": [
            {
              "$ref": "#/$defs/CompanyEmployees"
            },
            {
              "type": "null"
            }
          ],
          "description": "Latest monthly headcount at this location from CVR"
        },
        "employees_yearly": {
          "anyOf": [
            {
              "$ref": "#/$defs/CompanyEmployees"
            },
            {
              "type": "null"
            }
          ],
          "description": "CVR's yearly employment series at this location, which ends with 2018"
        },
        "contact": {
          "anyOf": [
            {
              "$ref": "#/$defs/CvrContact"
            },
            {
              "type": "null"
            }
          ],
          "description": "Contact information for this location"
        },
        "advertising_protected": {
          "type": "boolean",
          "title": "Advertising Protected",
          "description": "Whether unit is protected from advertising",
          "default": false
        },
        "meta": {
          "$ref": "#/$defs/ProductionUnitMeta",
          "description": "Record metadata"
        }
      },
      "type": "object",
      "required": [
        "p_number",
        "cvr"
      ],
      "title": "ProductionUnit",
      "description": "A production unit (P-enhed) - physical business location.\n\nP-enheder are separate entities in CVR with their own unique address,\nemployee counts, and industry classification."
    },
    "ProductionUnitMeta": {
      "properties": {
        "cvr_updated_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Cvr Updated At",
          "description": "Last sync from CVR"
        },
        "geocoded_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Geocoded At",
          "description": "When address was geocoded"
        },
        "synced_at": {
          "type": "string",
          "format": "date-time",
          "title": "Synced At",
          "description": "Last sync timestamp"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At",
          "description": "Record creation time"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "title": "Updated At",
          "description": "Record last update time"
        }
      },
      "type": "object",
      "title": "ProductionUnitMeta",
      "description": "Metadata for production unit records."
    },
    "SecondaryIndustry": {
      "properties": {
        "code": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Code",
          "description": "6-digit Danish industry code (DB07)"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Text",
          "description": "Industry description in Danish"
        }
      },
      "type": "object",
      "title": "SecondaryIndustry",
      "description": "Secondary industry classification."
    },
    "app__models__company__GeoLocation": {
      "properties": {
        "type": {
          "type": "string",
          "title": "Type",
          "description": "GeoJSON type (always 'Point')",
          "default": "Point"
        },
        "coordinates": {
          "items": {
            "type": "number"
          },
          "type": "array",
          "title": "Coordinates",
          "description": "Coordinates as [longitude, latitude]"
        }
      },
      "type": "object",
      "required": [
        "coordinates"
      ],
      "title": "GeoLocation",
      "description": "GeoJSON Point for geographic coordinates."
    }
  }
}