{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://casoon.github.io/typst-business-templates/schema/company.schema.json",
  "title": "Company",
  "description": "company.json: the issuing company, passed as `company:` to every template. Accounting templates (invoice, offer, credit note, reminder, letter, order confirmation, delivery note, quotation request, time sheet) read name, language, address and contact unconditionally; the other templates fall back to defaults when fields are missing.",
  "type": "object",
  "required": [
    "name",
    "address",
    "contact"
  ],
  "properties": {
    "$schema": {
      "type": "string",
      "description": "URL or path of this schema, for editor support."
    },
    "name": {
      "type": "string",
      "description": "Company name. Shown in headers, footers, the sender line and the signature; seller name in ZUGFeRD."
    },
    "language": {
      "type": "string",
      "enum": [
        "de",
        "en",
        "es",
        "fr",
        "it",
        "nl",
        "pt"
      ],
      "description": "Document language. Selects templates/locale/<language>.json and sets the text language. Optional, de if omitted."
    },
    "business_owner": {
      "type": [
        "string",
        "null"
      ],
      "description": "Owner or managing director. If set, used instead of the company name in the sender line and signature."
    },
    "logo": {
      "type": [
        "string",
        "null"
      ],
      "description": "Logo as a path from the project root, e.g. \"data/logo.png\". In Typst the value may also be the image bytes (read(\"/data/logo.png\", encoding: none)); bytes cannot be expressed in JSON, and templates imported as a package can only load the logo from bytes."
    },
    "logo_width": {
      "type": "string",
      "description": "Logo width as a Typst length, e.g. \"150pt\" or \"3cm\". Default 150pt.",
      "examples": [
        "150pt",
        "3cm"
      ]
    },
    "address": {
      "description": "Postal address of the company. The DIN 5008 sender line reads street, house_number, postal_code and city unconditionally.",
      "allOf": [
        {
          "$ref": "common.schema.json#/$defs/address"
        },
        {
          "required": [
            "house_number"
          ]
        }
      ]
    },
    "contact": {
      "type": "object",
      "description": "Contact details shown in headers and footers.",
      "properties": {
        "phone": {
          "type": "string",
          "description": "Phone number."
        },
        "email": {
          "type": "string",
          "description": "Email address; seller contact email in ZUGFeRD."
        },
        "website": {
          "type": "string",
          "description": "Website, e.g. www.example.com."
        }
      }
    },
    "tax_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Tax number (Steuernummer); seller tax registration in ZUGFeRD."
    },
    "vat_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "VAT identification number (USt-IdNr.), e.g. DE123456789; seller VAT ID in ZUGFeRD."
    },
    "bank_account": {
      "description": "Bank details for payment. When present, the accounting footer prints bank_name, account_holder, iban and bic; ZUGFeRD uses it as payee account.",
      "allOf": [
        {
          "$ref": "common.schema.json#/$defs/bank_account"
        },
        {
          "required": [
            "bank_name",
            "account_holder",
            "iban",
            "bic"
          ]
        }
      ]
    },
    "branding": {
      "type": "object",
      "description": "Colors and fonts used by the non-accounting templates (concept, proposal, documentation, credentials, ...).",
      "properties": {
        "primary_color": {
          "type": "string",
          "pattern": "^#?([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$",
          "description": "Primary color as hex string for Typst rgb(), e.g. \"#2c3e50\" (default)."
        },
        "accent_color": {
          "type": "string",
          "pattern": "^#?([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$",
          "description": "Accent color as hex string for Typst rgb(), e.g. \"#E94B3C\" (default)."
        },
        "font_preset": {
          "type": "string",
          "enum": [
            "inter",
            "roboto",
            "open-sans",
            "lato",
            "montserrat",
            "source-sans",
            "poppins",
            "raleway",
            "nunito",
            "work-sans",
            "default"
          ],
          "description": "Font preset from styles.typ (body, heading and mono font). \"default\" is Helvetica; unknown names fall back to it."
        }
      }
    },
    "footer": {
      "type": "object",
      "description": "Custom footer layout for the company-footer() helper in styles.typ.",
      "properties": {
        "columns": {
          "type": "array",
          "description": "Footer columns, laid out with equal width (typically 1-4).",
          "items": {
            "type": "object",
            "properties": {
              "title": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Optional bold column title."
              },
              "lines": {
                "type": "array",
                "description": "Lines with placeholders: {name}, {business_owner}, {tax_id}, {vat_id}, {address.street|house_number|postal_code|city|country}, {contact.phone|email|website}, {bank_account.bank_name|iban|bic|account_holder}. Lines with unresolved placeholders are skipped.",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "default_terms": {
      "type": "object",
      "description": "Default commercial terms. The templates read only vat_exempt and vat_note; the other fields are defaults for tooling.",
      "properties": {
        "vat_exempt": {
          "type": "boolean",
          "description": "Company charges no VAT (e.g. Kleinunternehmer, § 19 UStG). Enables vat_note on invoices and credit notes."
        },
        "vat_note": {
          "type": "string",
          "description": "Exemption note printed on invoices and credit notes when vat_exempt is true."
        },
        "vat_rate": {
          "$ref": "common.schema.json#/$defs/decimal",
          "description": "Default VAT rate in percent. Not read by the templates."
        },
        "payment_days": {
          "type": "integer",
          "minimum": 0,
          "description": "Default payment term in days. Not read by the templates."
        },
        "hourly_rate": {
          "$ref": "common.schema.json#/$defs/decimal",
          "description": "Default hourly rate. Not read by the templates."
        },
        "daily_rate": {
          "$ref": "common.schema.json#/$defs/decimal",
          "description": "Default daily rate. Not read by the templates."
        },
        "currency": {
          "type": "string",
          "description": "Default currency, ISO 4217 code. Not read by the templates."
        },
        "warranty_months": {
          "type": "integer",
          "minimum": 0,
          "description": "Default warranty period in months. Not read by the templates."
        },
        "standard_terms": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Standard terms text lines. Not read by the templates."
        }
      }
    },
    "numbering": {
      "type": "object",
      "description": "Document numbering settings from the docgen scaffold. Not read by the templates.",
      "properties": {
        "year_format": {
          "type": "string",
          "description": "Year format in document numbers, e.g. \"short\"."
        },
        "prefixes": {
          "type": "object",
          "description": "Number prefix per document type, e.g. { \"invoice\": \"RE\" }.",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "structure": {
      "type": "object",
      "description": "Project folder settings from the docgen scaffold. Not read by the templates.",
      "properties": {
        "organize_by_year": {
          "type": "boolean",
          "description": "Group documents in per-year folders."
        }
      }
    }
  }
}
