{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/certifyos/main/json-schema/certifyos-create-group-request-schema.json",
  "title": "CreateGroupRequest",
  "description": "Request to create a new group with complete data",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/certifyos-group-api-openapi.yml#/components/schemas/CreateGroupRequest",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Group name"
    },
    "npi": {
      "type": "string",
      "pattern": "^\\d{10}$",
      "description": "National Provider Identifier"
    },
    "tin": {
      "type": "string",
      "description": "Tax Identification Number. Characters other than digits are removed before the group is saved, so 12-3456789 is stored as 123456789."
    },
    "contacts": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Contact"
      },
      "description": "Group contacts"
    },
    "specialtyIds": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Specialty IDs to associate with the group during creation (consistent with create practitioner pattern)"
    },
    "groupEffectiveDate": {
      "$ref": "#/$defs/LocalDate",
      "type": "string",
      "description": "Group effective date"
    },
    "externalGroupId": {
      "type": "string",
      "description": "External group ID from tenant system"
    },
    "addresses": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/GroupAddressData"
      },
      "description": "Group addresses"
    },
    "networks": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/NetworkAssociation"
      },
      "description": "Networks to associate with the group during creation"
    },
    "contactPerson": {
      "type": "object",
      "description": "Contact person information as JSON"
    },
    "active": {
      "type": "boolean",
      "description": "Whether the tenant group is currently active"
    },
    "npdbEnrollmentEnabled": {
      "type": "boolean",
      "description": "Whether NPDB enrollment is enabled"
    },
    "credentialingDelegation": {
      "type": "boolean",
      "description": "Whether credentialing is delegated"
    }
  },
  "$defs": {
    "Contact": {
      "type": "object",
      "description": "Contact information",
      "properties": {
        "name": {
          "type": "string",
          "description": "Contact name"
        },
        "email": {
          "type": "string",
          "description": "Contact email"
        },
        "phone": {
          "type": "string",
          "description": "Contact phone"
        },
        "title": {
          "type": "string",
          "description": "Contact title"
        },
        "department": {
          "type": "string",
          "description": "Contact department"
        }
      }
    },
    "GroupAddressData": {
      "type": "object",
      "description": "Group address information",
      "properties": {
        "addressType": {
          "type": "string",
          "description": "Address type"
        },
        "addressLine1": {
          "type": "string",
          "description": "Address line 1"
        },
        "addressLine2": {
          "type": "string",
          "description": "Address line 2"
        },
        "city": {
          "type": "string",
          "description": "City"
        },
        "state": {
          "type": "string",
          "description": "State"
        },
        "zip": {
          "type": "string",
          "description": "ZIP code"
        },
        "county": {
          "type": "string",
          "description": "County"
        },
        "country": {
          "type": "string",
          "description": "Country"
        },
        "isPrimary": {
          "type": "boolean",
          "description": "Whether this is the primary address"
        }
      }
    },
    "LocalDate": {
      "type": "string",
      "format": "date"
    },
    "NetworkAssociation": {
      "type": "object",
      "required": [
        "networkName"
      ],
      "description": "Network association information",
      "properties": {
        "networkName": {
          "type": "string",
          "description": "Network name"
        },
        "networkType": {
          "type": "string",
          "description": "Network type"
        },
        "networkEffectiveDate": {
          "type": "string",
          "description": "Network effective date"
        },
        "networkGroupStatus": {
          "type": "string",
          "description": "Group-network relationship status"
        },
        "networkGroupTerminationDate": {
          "type": "string",
          "description": "Group-network termination date"
        }
      }
    }
  }
}