{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/upgrowth-dz/json-schema/upgrowth-dz-casnos-estimate-schema.json",
  "title": "CasnosEstimate",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/upgrowth-dz-openapi.yml#/components/schemas/CasnosEstimate",
  "type": "object",
  "required": [
    "year",
    "regime",
    "inputs"
  ],
  "properties": {
    "year": {
      "type": "integer"
    },
    "regime": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "name": {
          "type": "string",
          "description": "The name of the regime, in the language of the request."
        }
      }
    },
    "inputs": {
      "type": "object",
      "properties": {
        "regime": {
          "type": "string"
        },
        "revenue": {
          "type": [
            "number",
            "null"
          ],
          "description": "The amount sent, null when none was."
        },
        "revenue_used": {
          "type": "boolean",
          "description": "Whether this regime uses the revenue."
        }
      }
    },
    "base": {
      "type": "object",
      "properties": {
        "coefficient_percent": {
          "type": [
            "number",
            "null"
          ],
          "description": "The share of the revenue that makes the base: 25 or 35 under the flat-rate regimes, 100 for the actual profit, null for the flat fee."
        },
        "raw_dzd": {
          "type": [
            "integer",
            "null"
          ],
          "description": "The base before the floor and the ceiling."
        },
        "floor_dzd": {
          "type": "integer",
          "description": "The floor of the base: the annual SNMG."
        },
        "ceiling_dzd": {
          "type": "integer",
          "description": "The ceiling of the base: twenty times the floor."
        },
        "applied_dzd": {
          "type": [
            "integer",
            "null"
          ],
          "description": "The base the rate was applied to."
        },
        "floored_to_floor": {
          "type": "boolean",
          "description": "True when the floor was applied."
        },
        "capped_at_ceiling": {
          "type": "boolean",
          "description": "True when the ceiling was applied."
        }
      }
    },
    "rate_percent": {
      "type": [
        "number",
        "null"
      ],
      "description": "The contribution rate, null for the flat fee."
    },
    "contribution_dzd": {
      "type": "object",
      "properties": {
        "annual": {
          "type": "integer"
        },
        "monthly": {
          "type": "integer"
        },
        "quarterly": {
          "type": "integer"
        },
        "pension": {
          "type": "integer",
          "description": "The pension share, half of the annual contribution."
        },
        "social_insurance": {
          "type": "integer",
          "description": "The social insurance share, half of the annual contribution."
        }
      }
    },
    "flat_fee_option": {
      "type": "boolean",
      "description": "True for the auto-entrepreneur flat fee."
    },
    "limitations": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "contribution_tnd": {
      "type": "object",
      "properties": {
        "quarterly": {
          "type": "number"
        },
        "annual": {
          "type": "number"
        },
        "monthly_equivalent": {
          "type": "number"
        }
      }
    },
    "valid": {
      "type": "object",
      "properties": {
        "from_quarter": {
          "type": "string"
        },
        "to_quarter": {
          "type": "string"
        },
        "label": {
          "type": "string"
        }
      }
    },
    "classes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "class": {
            "type": "integer"
          },
          "coefficient": {
            "type": "number"
          },
          "quarterly_base_tnd": {
            "type": "number"
          },
          "quarterly_contribution_tnd": {
            "type": "number"
          }
        }
      }
    },
    "source": {
      "$ref": "#/$defs/SourceRef"
    }
  },
  "$defs": {
    "SourceRef": {
      "type": "object",
      "required": [
        "url",
        "title",
        "retrieved"
      ],
      "properties": {
        "url": {
          "type": "string",
          "description": "The official page the record was read on.",
          "format": "uri"
        },
        "title": {
          "type": "string",
          "description": "What the page is."
        },
        "retrieved": {
          "type": "string",
          "description": "The day the page was read, as YYYY-MM-DD."
        }
      }
    }
  }
}