{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/devmargin-app/json-schema/devmargin-app-new-cost-schema.json",
  "title": "NewCost",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/devmargin-app-openapi-openapi.yml#/components/schemas/NewCost",
  "type": "object",
  "properties": {
    "label": {
      "type": "string",
      "minLength": 1
    },
    "amount": {
      "type": "number",
      "minimum": 0
    },
    "currency": {
      "type": "string",
      "pattern": "^[A-Z]{3}$"
    },
    "period": {
      "type": "string",
      "enum": [
        "monthly",
        "yearly",
        "once"
      ],
      "default": "monthly"
    },
    "incurredOn": {
      "type": "string",
      "format": "date",
      "description": "Required when `period` is `once`, and refused otherwise. A purchase\nis placed by its date and by nothing else; defaulting it to today\nwould put it in the wrong month, and the month is the whole point.\n"
    },
    "scope": {
      "type": "string",
      "enum": [
        "project",
        "shared"
      ],
      "default": "project"
    },
    "projectId": {
      "type": "string",
      "format": "uuid",
      "description": "Required when `scope` is `project`."
    },
    "sharedProjects": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "uuid"
      },
      "description": "Required when `scope` is `shared` — the bill is split equally\nacross them. A one-off cannot be shared.\n"
    }
  },
  "required": [
    "label",
    "amount",
    "currency"
  ]
}