{
  "openapi": "3.0.1",
  "info": {
    "title": "Sync API",
    "description": "Data synchronization service",
    "version": "v1.0.0"
  },
  "servers": [
    {
      "url": "https://sync.api.snokam.no"
    }
  ],
  "paths": {
    "/v1.0/protected/health/{provider}": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Checks an integration's connectivity",
        "operationId": "SyncIntegrationHealth",
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Payload of IntegrationHealthResult",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/integrationHealthResult"
                }
              }
            },
            "x-ms-summary": "Health result"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1.0/cv-partner-to-sanity": {
      "get": {
        "tags": [
          "Sync"
        ],
        "summary": "Syncs CV Partner to Sanity",
        "description": "Synchronizes data from CV Partner to Sanity.",
        "operationId": "SyncCvPartnerToSanity",
        "responses": {
          "200": {
            "description": "Data synchronized successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "x-ms-summary": "Success"
          },
          "401": {
            "description": "Unauthorized access",
            "x-ms-summary": "Unauthorized"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1.0/power-office-to-sanity": {
      "get": {
        "tags": [
          "Sync"
        ],
        "summary": "Sync power office data to sanity",
        "description": "Sync power office data to sanity",
        "operationId": "SyncPowerOfficeToSanity",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "description": "",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "x-ms-summary": "Date from"
          },
          {
            "name": "to",
            "in": "query",
            "description": "",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "x-ms-summary": "Date to"
          }
        ],
        "responses": {
          "200": {
            "description": "Data synchronized successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "x-ms-summary": "Success"
          },
          "401": {
            "description": "Unauthorized access",
            "x-ms-summary": "Unauthorized"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1.0/sanity-groups-to-azure-ad": {
      "get": {
        "tags": [
          "Sync"
        ],
        "summary": "Syncs Sanity workgroups to Azure AD",
        "description": "Mirrors the Sanity workgroup taxonomy to Azure AD security groups, and reconciles each group's membership against the Sanity-tracked employees. Same handler the cron runs.",
        "operationId": "SyncSanityGroupsToAzureAd",
        "responses": {
          "200": {
            "description": "Sync stats — groups created/updated, members added/removed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/syncSanityGroupsResult"
                }
              }
            },
            "x-ms-summary": "Success"
          },
          "401": {
            "description": "Unauthorized access",
            "x-ms-summary": "Unauthorized"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1.0/okrs-to-sanity": {
      "get": {
        "tags": [
          "Sync"
        ],
        "summary": "Sync OKRs",
        "description": "Synchronizes OKRs",
        "operationId": "SyncOkrs",
        "responses": {
          "200": {
            "description": "OKRs synchronized successfully",
            "x-ms-summary": "Success"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "integrationHealthResult": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "syncSanityGroupsResult": {
        "type": "object",
        "properties": {
          "groupsCreated": {
            "type": "integer",
            "format": "int32"
          },
          "groupsUpdated": {
            "type": "integer",
            "format": "int32"
          },
          "membersAdded": {
            "type": "integer",
            "format": "int32"
          },
          "membersRemoved": {
            "type": "integer",
            "format": "int32"
          }
        }
      }
    },
    "securitySchemes": {
      "Implicit": {
        "type": "oauth2",
        "flows": {
          "implicit": {
            "authorizationUrl": "https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize",
            "tokenUrl": "https://login.microsoftonline.com/organizations/oauth2/v2.0/token",
            "refreshUrl": "https://login.microsoftonline.com/organizations/oauth2/v2.0/token",
            "scopes": {
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default": "Default function scope"
            }
          }
        }
      },
      "ApiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  }
}