json icon

Franchise Created

v1.2.0events

A franchise unit was created in CNA Nexus by activating an opening contract. Full snapshot of the unit; cna-one mirrors it, its address and its partners as employees.

1{
2  "$schema": "https://json-schema.org/draft/2020-12/schema",
3  "title": "FranchiseCreated payload",
4  "type": "object",
5  "additionalProperties": false,
6  "properties": {
7    "id": {
8      "type": "string",
9      "description": "Franchise id (UUID). Kafka message key; cna-one mirrors the unit under this id."
10    },
11    "name": { "type": "string", "description": "Unit name." },
12    "code": {
13      "type": ["string", "null"],
14      "description": "Internal unit code, unique."
15    },
16    "cnpj": {
17      "type": ["string", "null"],
18      "description": "Company registration number as stored (no normalisation). cna-one requires and validates it."
19    },
20    "legalName": {
21      "type": ["string", "null"],
22      "description": "Legal company name. cna-one requires it."
23    },
24    "email": {
25      "type": ["string", "null"],
26      "format": "email",
27      "description": "Primary contact e-mail of the unit (franchises.email in cna-nexus, not unique there). cna-one mirrors it and requires it to be unique across its franchises."
28    },
29    "whatsapp": {
30      "type": ["string", "null"],
31      "pattern": "^\\+[1-9]\\d{6,14}$",
32      "description": "WhatsApp number in E.164 (+5511912345678). Mirrored by cna-one."
33    },
34    "phone": {
35      "type": ["string", "null"],
36      "pattern": "^\\+[1-9]\\d{6,14}$",
37      "description": "Primary contact phone in E.164. Mirrored by cna-one."
38    },
39    "stateRegistration": {
40      "type": ["string", "null"],
41      "description": "State registration number."
42    },
43    "taxRegime": {
44      "type": ["string", "null"],
45      "enum": ["SIMPLES_NACIONAL", "LUCRO_PRESUMIDO", "LUCRO_REAL", null],
46      "description": "Tax regime (FranchiseTaxRegime), typed as string in the class."
47    },
48    "protheusId": {
49      "type": ["string", "null"],
50      "description": "Id in the Protheus ERP."
51    },
52    "conectaEnabled": {
53      "type": "boolean",
54      "description": "Inter-school sharing enabled."
55    },
56    "openingStatus": {
57      "type": "string",
58      "enum": [
59        "CREATED",
60        "BUILT",
61        "TRAINED",
62        "SUSPENDED",
63        "UNDER_REVIEW",
64        "DEFAULTING"
65      ],
66      "description": "Lifecycle stage (FranchiseOpeningStatus), typed as string in the class."
67    },
68    "operationalStatus": {
69      "type": "string",
70      "enum": ["OPERATIONAL", "NON_OPERATIONAL", "UNDER_DEVELOPMENT"],
71      "description": "Operational status (FranchiseOperationalStatus). cna-one maps OPERATIONAL to ACTIVE, anything else to INACTIVE."
72    },
73    "financialStatus": {
74      "type": ["string", "null"],
75      "enum": [
76        "ACTIVE",
77        "INACTIVE",
78        "SUSPENDED",
79        "DEFAULTING",
80        "UNDER_REVIEW",
81        null
82      ],
83      "description": "Financial standing (FranchiseFinancialStatus)."
84    },
85    "operationalStartAt": {
86      "type": ["string", "null"],
87      "format": "date-time",
88      "description": "ISO-8601 instant when operations started."
89    },
90    "operationalEndAt": {
91      "type": ["string", "null"],
92      "format": "date-time",
93      "description": "ISO-8601 instant when operations ended."
94    },
95    "firstContractStartsOn": {
96      "type": ["string", "null"],
97      "format": "date",
98      "description": "YYYY-MM-DD start of the earliest opening contract, or null. Ignored by cna-one."
99    },
100    "category": {
101      "type": "object",
102      "additionalProperties": false,
103      "description": "Size/type category of the unit.",
104      "properties": {
105        "id": { "type": "string", "description": "Category id (UUID)." },
106        "name": { "type": "string", "description": "Category name." },
107        "isActive": {
108          "type": "boolean",
109          "description": "Whether the category is active."
110        }
111      },
112      "required": ["id", "name", "isActive"]
113    },
114    "economicGroup": {
115      "type": ["object", "null"],
116      "additionalProperties": false,
117      "description": "Economic group of the unit, or null. cna-one requires the group to have been mirrored first (EconomicGroupCreated).",
118      "properties": {
119        "id": { "type": "string", "description": "Economic group id (UUID)." },
120        "name": { "type": "string", "description": "Group name." },
121        "isActive": {
122          "type": "boolean",
123          "description": "Whether the group is active."
124        }
125      },
126      "required": ["id", "name", "isActive"]
127    },
128    "operationalRegion": {
129      "type": ["object", "null"],
130      "additionalProperties": false,
131      "description": "Operational region, or null.",
132      "properties": {
133        "id": { "type": "string", "description": "Region id (UUID)." },
134        "name": { "type": "string", "description": "Region name." }
135      },
136      "required": ["id", "name"]
137    },
138    "address": {
139      "type": ["object", "null"],
140      "additionalProperties": false,
141      "description": "Unit address, or null. cna-one requires street, number, neighborhood, postalCode and cityId to mirror it; it ignores countryId, foreignCity, foreignState, latitude and longitude.",
142      "properties": {
143        "street": { "type": ["string", "null"], "description": "Street." },
144        "number": { "type": ["string", "null"], "description": "Number." },
145        "complement": {
146          "type": ["string", "null"],
147          "description": "Complement."
148        },
149        "neighborhood": {
150          "type": ["string", "null"],
151          "description": "Neighborhood."
152        },
153        "postalCode": {
154          "type": ["string", "null"],
155          "description": "Postal code as stored; cna-one strips it to 8 digits."
156        },
157        "cityId": {
158          "type": ["integer", "null"],
159          "description": "IBGE city code (common.cities.id). Must exist in cna-one. Null for an address outside Brazil."
160        },
161        "cityName": {
162          "type": ["string", "null"],
163          "description": "City name. Null for an address outside Brazil. Ignored by cna-one."
164        },
165        "state": {
166          "type": ["string", "null"],
167          "description": "State code (UF). Null for an address outside Brazil. Ignored by cna-one."
168        },
169        "countryId": {
170          "type": "string",
171          "description": "Country as an ISO 3166-1 alpha-2 code (BR for Brazil). Always present. Ignored by cna-one."
172        },
173        "foreignCity": {
174          "type": ["string", "null"],
175          "description": "Free-text city name for an address outside Brazil; null for a Brazilian address. Ignored by cna-one."
176        },
177        "foreignState": {
178          "type": ["string", "null"],
179          "description": "Free-text state or province name for an address outside Brazil; null for a Brazilian address. Ignored by cna-one."
180        },
181        "latitude": {
182          "type": ["string", "null"],
183          "description": "Latitude in WGS84 as decimal text (ST_Y over the location point), or null when the address has no coordinates. Ignored by cna-one."
184        },
185        "longitude": {
186          "type": ["string", "null"],
187          "description": "Longitude in WGS84 as decimal text (ST_X over the location point), or null when the address has no coordinates. Ignored by cna-one."
188        }
189      },
190      "required": ["countryId"]
191    },
192    "partners": {
193      "type": "array",
194      "description": "People behind the unit. May be empty. Roles are not included; cna-one turns each into a FRANCHISEE employee.",
195      "items": {
196        "type": "object",
197        "additionalProperties": false,
198        "properties": {
199          "id": {
200            "type": "string",
201            "description": "Person id (UUID) in cna-nexus, the same id the FranchisePartner events carry in person.id. Was personId until 1.1.0. cna-one correlates partners by document, not by this id."
202          },
203          "document": {
204            "type": "string",
205            "description": "Person document; format depends on documentType."
206          },
207          "documentType": {
208            "type": "string",
209            "enum": ["CPF", "CNPJ", "RNM"],
210            "description": "Document type (PersonsDocumentType), typed as string in the class."
211          },
212          "name": { "type": "string", "description": "Person name." },
213          "legalName": {
214            "type": ["string", "null"],
215            "description": "Legal name, for companies."
216          },
217          "email": {
218            "type": ["string", "null"],
219            "description": "E-mail. cna-one requires an e-mail to create the employee."
220          }
221        },
222        "required": ["id", "document", "documentType", "name"]
223      }
224    },
225    "products": {
226      "type": "array",
227      "description": "Products the unit is enabled to sell. cna-one keeps only the distinct sub-categories.",
228      "items": {
229        "type": "object",
230        "additionalProperties": false,
231        "properties": {
232          "id": { "type": "string", "description": "Product id (UUID)." },
233          "name": { "type": "string", "description": "Product name." },
234          "subCategory": {
235            "type": "string",
236            "enum": [
237              "ENGLISH",
238              "SPANISH",
239              "PROGRAMMING",
240              "AI",
241              "CREATOR_ECONOMY"
242            ],
243            "description": "Catalog sub-category (ProductSubCategory)."
244          }
245        },
246        "required": ["id", "name", "subCategory"]
247      }
248    }
249  },
250  "required": [
251    "id",
252    "name",
253    "conectaEnabled",
254    "openingStatus",
255    "operationalStatus",
256    "category",
257    "partners",
258    "products"
259  ]
260}
261

Details

Format
JSON Schema
Resource
events
Filename
schema.json

Versions