json icon

Franchise Updated

v2.1.0events

A franchise unit changed in CNA Nexus - edited in one of the franchise screens, re-activated from a contract, or amended. Full snapshot. cna-one consumes it (cna-br/cna-one#890) to keep its mirror of the unit, its address and its partners in sync.

1{
2  "$schema": "https://json-schema.org/draft/2020-12/schema",
3  "title": "FranchiseUpdated 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": [
46        "SIMPLES_NACIONAL",
47        "LUCRO_PRESUMIDO",
48        "LUCRO_REAL",
49        "MEI",
50        null
51      ],
52      "description": "Tax regime (FranchiseTaxRegime), typed as string in the class."
53    },
54    "protheusId": {
55      "type": ["string", "null"],
56      "description": "Id in the Protheus ERP."
57    },
58    "conectaEnabled": {
59      "type": "boolean",
60      "description": "Inter-school sharing enabled."
61    },
62    "openingStatus": {
63      "type": "string",
64      "enum": [
65        "CREATED",
66        "BUILT",
67        "TRAINED",
68        "SUSPENDED",
69        "UNDER_REVIEW",
70        "DEFAULTING"
71      ],
72      "description": "Lifecycle stage (FranchiseOpeningStatus), typed as string in the class."
73    },
74    "operationalStatus": {
75      "type": "string",
76      "enum": ["OPERATIONAL", "NON_OPERATIONAL", "UNDER_DEVELOPMENT"],
77      "description": "Operational status (FranchiseOperationalStatus). cna-one maps OPERATIONAL to ACTIVE, anything else to INACTIVE."
78    },
79    "financialStatus": {
80      "type": ["string", "null"],
81      "enum": [
82        "ACTIVE",
83        "INACTIVE",
84        "SUSPENDED",
85        "DEFAULTING",
86        "UNDER_REVIEW",
87        null
88      ],
89      "description": "Financial standing (FranchiseFinancialStatus)."
90    },
91    "operationalStartOn": {
92      "type": ["string", "null"],
93      "format": "date",
94      "description": "YYYY-MM-DD day the unit started operating, or null. Ignored by cna-one."
95    },
96    "operationalEndOn": {
97      "type": ["string", "null"],
98      "format": "date",
99      "description": "YYYY-MM-DD day the unit stopped operating, or null. Ignored by cna-one."
100    },
101    "firstContractStartsOn": {
102      "type": ["string", "null"],
103      "format": "date",
104      "description": "YYYY-MM-DD start of the earliest opening contract, or null. Ignored by cna-one."
105    },
106    "category": {
107      "type": "object",
108      "additionalProperties": false,
109      "description": "Size/type category of the unit.",
110      "properties": {
111        "id": { "type": "string", "description": "Category id (UUID)." },
112        "name": { "type": "string", "description": "Category name." },
113        "isActive": {
114          "type": "boolean",
115          "description": "Whether the category is active."
116        }
117      },
118      "required": ["id", "name", "isActive"]
119    },
120    "economicGroup": {
121      "type": ["object", "null"],
122      "additionalProperties": false,
123      "description": "Economic group of the unit, or null. cna-one requires the group to have been mirrored first (EconomicGroupCreated).",
124      "properties": {
125        "id": { "type": "string", "description": "Economic group id (UUID)." },
126        "name": { "type": "string", "description": "Group name." },
127        "isActive": {
128          "type": "boolean",
129          "description": "Whether the group is active."
130        }
131      },
132      "required": ["id", "name", "isActive"]
133    },
134    "operationalRegion": {
135      "type": ["object", "null"],
136      "additionalProperties": false,
137      "description": "Operational region, or null.",
138      "properties": {
139        "id": { "type": "string", "description": "Region id (UUID)." },
140        "name": { "type": "string", "description": "Region name." }
141      },
142      "required": ["id", "name"]
143    },
144    "address": {
145      "type": ["object", "null"],
146      "additionalProperties": false,
147      "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.",
148      "properties": {
149        "street": { "type": ["string", "null"], "description": "Street." },
150        "number": { "type": ["string", "null"], "description": "Number." },
151        "complement": {
152          "type": ["string", "null"],
153          "description": "Complement."
154        },
155        "neighborhood": {
156          "type": ["string", "null"],
157          "description": "Neighborhood."
158        },
159        "postalCode": {
160          "type": ["string", "null"],
161          "description": "Postal code as stored; cna-one strips it to 8 digits."
162        },
163        "cityId": {
164          "type": ["integer", "null"],
165          "description": "IBGE city code (common.cities.id). Must exist in cna-one. Null for an address outside Brazil."
166        },
167        "cityName": {
168          "type": ["string", "null"],
169          "description": "City name. Null for an address outside Brazil. Ignored by cna-one."
170        },
171        "state": {
172          "type": ["string", "null"],
173          "description": "State code (UF). Null for an address outside Brazil. Ignored by cna-one."
174        },
175        "countryId": {
176          "type": "string",
177          "description": "Country as an ISO 3166-1 alpha-2 code (BR for Brazil). Always present. Ignored by cna-one."
178        },
179        "foreignCity": {
180          "type": ["string", "null"],
181          "description": "Free-text city name for an address outside Brazil; null for a Brazilian address. Ignored by cna-one."
182        },
183        "foreignState": {
184          "type": ["string", "null"],
185          "description": "Free-text state or province name for an address outside Brazil; null for a Brazilian address. Ignored by cna-one."
186        },
187        "latitude": {
188          "type": ["string", "null"],
189          "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."
190        },
191        "longitude": {
192          "type": ["string", "null"],
193          "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."
194        }
195      },
196      "required": ["countryId"]
197    },
198    "partners": {
199      "type": "array",
200      "description": "People behind the unit. May be empty. Roles are not included; cna-one turns each into a FRANCHISEE employee.",
201      "items": {
202        "type": "object",
203        "additionalProperties": false,
204        "properties": {
205          "id": {
206            "type": "string",
207            "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."
208          },
209          "document": {
210            "type": "string",
211            "description": "Person document; format depends on documentType."
212          },
213          "documentType": {
214            "type": "string",
215            "enum": ["CPF", "CNPJ", "RNM"],
216            "description": "Document type (PersonsDocumentType), typed as string in the class."
217          },
218          "name": { "type": "string", "description": "Person name." },
219          "legalName": {
220            "type": ["string", "null"],
221            "description": "Legal name, for companies."
222          },
223          "email": {
224            "type": ["string", "null"],
225            "description": "E-mail. cna-one requires an e-mail to create the employee."
226          }
227        },
228        "required": ["id", "document", "documentType", "name"]
229      }
230    },
231    "products": {
232      "type": "array",
233      "description": "Products the unit is enabled to sell. cna-one keeps only the distinct sub-categories.",
234      "items": {
235        "type": "object",
236        "additionalProperties": false,
237        "properties": {
238          "id": { "type": "string", "description": "Product id (UUID)." },
239          "name": { "type": "string", "description": "Product name." },
240          "subCategory": {
241            "type": "string",
242            "enum": [
243              "ENGLISH",
244              "SPANISH",
245              "PROGRAMMING",
246              "AI",
247              "CREATOR_ECONOMY"
248            ],
249            "description": "Catalog sub-category (ProductSubCategory)."
250          }
251        },
252        "required": ["id", "name", "subCategory"]
253      }
254    }
255  },
256  "required": [
257    "id",
258    "name",
259    "conectaEnabled",
260    "openingStatus",
261    "operationalStatus",
262    "category",
263    "partners",
264    "products"
265  ]
266}
267

Details

Format
JSON Schema
Resource
events
Filename
schema.json

Versions