
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "ListaFirme API v3 Schema Bundle",
  "description": "Bundle cu schemele JSON pentru errorResponse, searchSuccess si infoSuccess.",
  "type": "object",
  "$defs": {
    "creditString": {
      "type": "string",
      "pattern": "^\\d+\\.\\d{2}$"
    },
    "errorResponse": {
      "type": "object",
      "required": ["errorCode", "error"],
      "properties": {
        "errorCode": {
          "type": "string"
        },
        "error": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "searchResult": {
      "type": "object",
      "required": ["Name", "FiscalCode", "County", "URL"],
      "properties": {
        "Name": { "type": "string" },
        "FiscalCode": { "type": "string" },
        "County": { "type": "string" },
        "URL": { "type": "string" }
      },
      "additionalProperties": false
    },
    "searchSuccess": {
      "type": "object",
      "required": ["Results", "hasMore", "cost", "credits"],
      "properties": {
        "Results": {
          "type": "array",
          "items": { "$ref": "#/$defs/searchResult" },
          "maxItems": 50
        },
        "hasMore": {
          "type": "boolean"
        },
        "cost": {
          "$ref": "#/$defs/creditString"
        },
        "credits": {
          "$ref": "#/$defs/creditString"
        }
      },
      "additionalProperties": false
    },
    "contactPerson": {
      "type": "object",
      "required": ["Name", "Sex", "Nationality", "Position", "Active"],
      "properties": {
        "Name": { "type": "string" },
        "Sex": { "type": "string" },
        "Nationality": { "type": "string" },
        "Position": { "type": "string" },
        "Active": { "type": "boolean" }
      },
      "additionalProperties": false
    },
    "administrator": {
      "type": "object",
      "required": ["Name", "Sex", "Nationality", "Position", "Active"],
      "properties": {
        "Name": { "type": "string" },
        "FiscalCode": { "type": "string" },
        "Sex": { "type": "string" },
        "Nationality": { "type": "string" },
        "Position": { "type": "string" },
        "Active": { "type": "boolean" }
      },
      "additionalProperties": false
    },
    "shareholder": {
      "type": "object",
      "required": ["Name", "Sex", "Nationality", "Position", "Shares"],
      "properties": {
        "Name": { "type": "string" },
        "FiscalCode": { "type": "string" },
        "Sex": { "type": "string" },
        "Nationality": { "type": "string" },
        "Position": { "type": "string" },
        "Shares": { "type": "string" }
      },
      "additionalProperties": false
    },
    "beneficiary": {
      "type": "object",
      "required": ["Name", "Sex", "Nationality"],
      "properties": {
        "Name": { "type": "string" },
        "Sex": { "type": "string" },
        "Nationality": { "type": "string" }
      },
      "additionalProperties": false
    },
    "balanceItem": {
      "type": "object",
      "required": ["Year", "FixedAssets", "CurrentAssets", "Turnover", "NetProfit", "GrossProfit", "Debts", "EquityOwnership", "Stocks", "Cash", "Receivables", "Income", "Outgoings", "Employees", "NACE", "NACERev"],
      "properties": {
        "Year": { "type": "string" },
        "FixedAssets": { "type": "string" },
        "CurrentAssets": { "type": "string" },
        "Turnover": { "type": "string" },
        "NetProfit": { "type": "string" },
        "GrossProfit": { "type": "string" },
        "Debts": { "type": "string" },
        "EquityOwnership": { "type": "string" },
        "Stocks": { "type": "string" },
        "Cash": { "type": "string" },
        "Receivables": { "type": "string" },
        "Income": { "type": "string" },
        "Outgoings": { "type": "string" },
        "AdvanceIncome": { "type": "string" },
        "AdvanceExpenses": { "type": "string" },
        "Employees": { "type": "string" },
        "NACE": { "type": "string" },
        "NACERev": { "type": "string" }
      },
      "additionalProperties": false
    },
    "principalNaceItem": {
      "type": "object",
      "required": ["Code", "Rev"],
      "properties": {
        "Code": { "type": "string" },
        "Rev": { "type": "string" }
      },
      "additionalProperties": false
    },
    "insolvencyRisk": {
      "type": "object",
      "required": ["Percentage", "BalanceYear", "PredictionYear"],
      "properties": {
        "Percentage": { "type": "string", "pattern": "^(?:100\\.00|(?:[0-9]|[1-9][0-9])\\.[0-9]{2})$" },
        "BalanceYear": { "type": "string", "pattern": "^[0-9]{4}$" },
        "PredictionYear": { "type": "string", "pattern": "^[0-9]{4}$" }
      },
      "additionalProperties": false
    },
    "geolocation": {
      "type": "object",
      "required": ["Lat", "Lng", "Approximated"],
      "properties": {
        "Lat": { "type": "string" },
        "Lng": { "type": "string" },
        "Approximated": { "type": "boolean" }
      },
      "additionalProperties": false
    },
    "fiscalAction": {
      "type": "object",
      "required": ["Authority", "Date", "Observations", "VAT"],
      "properties": {
        "Authority": { "type": "string" },
        "Date": { "type": "string" },
        "Observations": { "type": "string" },
        "VAT": { "type": "string" }
      },
      "additionalProperties": false
    },
    "fiscalActivity": {
      "type": "object",
      "required": ["Issued", "Radiated", "History", "Inactivation", "Reactivation"],
      "properties": {
        "Issued": { "type": "string" },
        "Radiated": { "type": "string" },
        "History": { "type": "boolean" },
        "Inactivation": { "$ref": "#/$defs/fiscalAction" },
        "Reactivation": { "$ref": "#/$defs/fiscalAction" }
      },
      "additionalProperties": false
    },
    "obligations": {
      "type": "object",
      "required": ["StateBudget", "SocialInsurance", "HealthInsurance", "Unemployment", "Total"],
      "properties": {
        "StateBudget": { "type": "string" },
        "SocialInsurance": { "type": "string" },
        "HealthInsurance": { "type": "string" },
        "Unemployment": { "type": "string" },
        "Total": { "type": "string" }
      },
      "additionalProperties": false
    },
    "marketplaceItem": {
      "type": "object",
      "required": ["Platform", "URL"],
      "properties": {
        "Platform": { "type": "string" },
        "URL": { "type": "string" }
      },
      "additionalProperties": false
    },
    "bpiInfo": {
      "type": "object",
      "required": ["BulletinNumber", "Date"],
      "properties": {
        "BulletinNumber": { "type": "string" },
        "Date": { "type": "string" }
      },
      "additionalProperties": false
    },
    "formerNameItem": {
      "type": "object",
      "required": ["Name", "Date"],
      "properties": {
        "Name": { "type": "string" },
        "Date": { "type": "string" }
      },
      "additionalProperties": false
    },
    "workLocationItem": {
      "type": "object",
      "required": ["County", "City", "Address"],
      "properties": {
        "County": { "type": "string" },
        "City": { "type": "string" },
        "Address": { "type": "string" }
      },
      "additionalProperties": false
    },
    "linkItem": {
      "type": "object",
      "required": ["TaxCode", "Name"],
      "properties": {
        "TaxCode": { "type": "string" },
        "Name": { "type": "string" }
      },
      "additionalProperties": false
    },
    "naceInfo": {
      "type": "object",
      "required": ["Code", "DescriptionRO", "DescriptionEN"],
      "properties": {
        "Code": { "type": "string" },
        "DescriptionRO": { "type": "string" },
        "DescriptionEN": { "type": "string" }
      },
      "additionalProperties": false
    },
    "infoSuccess": {
      "type": "object",
      "required": ["TaxCode", "cost", "credits"],
      "properties": {
        "TaxCode": { "type": "string" },
        "RegNo": { "type": "string" },
        "Status": { "type": "string" },
        "LegalForm": { "type": "string" },
        "EntityType": { "type": "string" },
        "Name": { "type": "string" },
        "NACE": {
          "oneOf": [
            { "type": "string" },
            { "$ref": "#/$defs/naceInfo" }
          ]
        },
        "PrincipalNACE": {
          "type": "array",
          "items": { "$ref": "#/$defs/principalNaceItem" },
          "maxItems": 1
        },
        "NACERev": { "type": "string" },
        "Date": { "type": "string" },
        "TownCode": { "type": "string" },
        "County": { "type": "string" },
        "City": { "type": "string" },
        "Address": { "type": "string" },
        "Validity": { "type": "string" },
        "VAT": { "type": "boolean" },
        "Inactive": { "type": "boolean" },
        "ContactPerson": { "$ref": "#/$defs/contactPerson" },
        "Administrators": {
          "type": "array",
          "items": { "$ref": "#/$defs/administrator" }
        },
        "Shareholders": {
          "type": "array",
          "items": { "$ref": "#/$defs/shareholder" }
        },
        "Beneficiary": {
          "type": "array",
          "items": { "$ref": "#/$defs/beneficiary" }
        },
        "Balance": {
          "type": "array",
          "items": { "$ref": "#/$defs/balanceItem" }
        },
        "Year": { "type": "string" },
        "Turnover": { "type": "string" },
        "Profit": { "type": "string" },
        "Employees": { "type": "string" },
        "InsolvencyRisk": { "$ref": "#/$defs/insolvencyRisk" },
        "Phone": {
          "type": "array",
          "items": { "type": "string" },
          "maxItems": 2
        },
        "Mobile": {
          "type": "array",
          "items": { "type": "string" },
          "maxItems": 2
        },
        "Email": {
          "type": "array",
          "items": { "type": "string" },
          "maxItems": 2
        },
        "Web": {
          "type": "array",
          "items": { "type": "string" },
          "maxItems": 2
        },
        "Geolocation": { "$ref": "#/$defs/geolocation" },
        "Description": { "type": "string" },
        "Trademarks": {
          "type": "array",
          "items": { "type": "string" },
          "maxItems": 5
        },
        "Marketplaces": {
          "type": "array",
          "items": { "$ref": "#/$defs/marketplaceItem" }
        },
        "Subsidiaries": { "type": "string" },
        "Branches": { "type": "string" },
        "FiscalActivity": { "$ref": "#/$defs/fiscalActivity" },
        "Obligations": { "$ref": "#/$defs/obligations" },
        "BPI": { "$ref": "#/$defs/bpiInfo" },
        "FormerNames": {
          "type": "array",
          "items": { "$ref": "#/$defs/formerNameItem" }
        },
        "WorkLocations": {
          "type": "array",
          "items": { "$ref": "#/$defs/workLocationItem" },
          "maxItems": 100
        },
        "SEAPPublicTenders": { "type": "boolean" },
        "SEAPDirectSales": { "type": "boolean" },
        "Links": {
          "type": "array",
          "items": { "$ref": "#/$defs/linkItem" }
        },
        "cost": { "$ref": "#/$defs/creditString" },
        "credits": { "$ref": "#/$defs/creditString" }
      },
      "additionalProperties": false
    }
  }
}
