{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/france-identite/json-schema/france-identite-organisation-response-schema.json",
  "title": "OrganisationResponse",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/france-identite-intermediaries-openapi.yml#/components/schemas/OrganisationResponse",
  "type": "object",
  "required": [
    "organisation"
  ],
  "properties": {
    "organisation": {
      "type": "object",
      "required": [
        "id",
        "status"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "legalName": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "isIntermediary": {
          "type": "boolean"
        },
        "requestTemplates": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RequestTemplate"
          }
        },
        "actingFor": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "associationId",
              "relyingParty",
              "serviceIdentifier",
              "intendedUseIdentifier"
            ],
            "properties": {
              "associationId": {
                "type": "string"
              },
              "relyingParty": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "legalName": {
                    "type": "string"
                  },
                  "sub": {
                    "type": "string"
                  }
                }
              },
              "serviceIdentifier": {
                "type": "string"
              },
              "serviceTradeName": {
                "type": "string"
              },
              "intendedUseIdentifier": {
                "type": "string"
              },
              "since": {
                "type": "string",
                "format": "date-time"
              },
              "registrationCertificate": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "jws": {
                    "$ref": "#/$defs/CompactJws"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "$defs": {
    "CompactJws": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$"
    },
    "CredentialQuery": {
      "type": "object",
      "required": [
        "format",
        "meta",
        "claims"
      ],
      "properties": {
        "format": {
          "type": "string",
          "enum": [
            "mso_mdoc",
            "dc+sd-jwt"
          ]
        },
        "meta": {
          "type": "object",
          "description": "`doctype_value` for an mdoc, `vct` for an SD-JWT.",
          "properties": {
            "doctype_value": {
              "type": "string"
            },
            "vct": {
              "type": "string"
            }
          }
        },
        "claims": {
          "type": "array",
          "minItems": 1,
          "maxItems": 100,
          "items": {
            "type": "object",
            "required": [
              "path"
            ],
            "properties": {
              "path": {
                "type": "array",
                "minItems": 1,
                "maxItems": 10,
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "MultiLangText": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "lang",
          "content"
        ],
        "properties": {
          "lang": {
            "type": "string"
          },
          "content": {
            "type": "string",
            "maxLength": 1000
          }
        }
      }
    },
    "RequestTemplate": {
      "allOf": [
        {
          "$ref": "#/$defs/RequestTemplateInput"
        },
        {
          "type": "object",
          "required": [
            "templateId",
            "version"
          ],
          "properties": {
            "version": {
              "type": "integer",
              "minimum": 1,
              "description": "Raised on each change."
            },
            "createdAt": {
              "type": "string",
              "format": "date-time"
            },
            "updatedAt": {
              "type": "string",
              "format": "date-time"
            }
          }
        }
      ]
    },
    "RequestTemplateInput": {
      "type": "object",
      "required": [
        "name",
        "purpose",
        "credentials"
      ],
      "properties": {
        "templateId": {
          "type": "string",
          "description": "Present to publish a new version of this request."
        },
        "name": {
          "type": "string",
          "maxLength": 120,
          "description": "As clients see it."
        },
        "purpose": {
          "$ref": "#/$defs/MultiLangText"
        },
        "credentials": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/CredentialQuery"
          }
        }
      }
    }
  }
}