sgp-sdk 1.1.3 → 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/COMPATIBILITY.md +151 -0
  3. package/MIGRATION.md +283 -0
  4. package/README.md +424 -225
  5. package/dist/address.d.ts +46 -0
  6. package/dist/annotation-selection.d.ts +32 -0
  7. package/dist/budget.d.ts +29 -0
  8. package/dist/classify.d.ts +15 -0
  9. package/dist/client.d.ts +662 -155
  10. package/dist/config.d.ts +115 -0
  11. package/dist/constants.d.ts +72 -0
  12. package/dist/effect.d.ts +22 -0
  13. package/dist/executor.d.ts +9 -0
  14. package/dist/exposure.d.ts +21 -0
  15. package/dist/guards.d.ts +2 -0
  16. package/dist/hooks.d.ts +16 -0
  17. package/dist/ids.d.ts +19 -0
  18. package/dist/index.d.ts +45 -47
  19. package/dist/index.js +2954 -1223
  20. package/dist/operation-sensitivity.d.ts +496 -0
  21. package/dist/operation.d.ts +139 -0
  22. package/dist/operations/catalogs-list-billing-profiles.d.ts +16 -0
  23. package/dist/operations/catalogs-list-nas.d.ts +25 -0
  24. package/dist/operations/catalogs-list-pops.d.ts +14 -0
  25. package/dist/operations/contracts-list-status-reasons.d.ts +15 -0
  26. package/dist/operations/contracts-list.d.ts +52 -0
  27. package/dist/operations/contracts-update-status.d.ts +41 -0
  28. package/dist/operations/contracts-update.d.ts +39 -0
  29. package/dist/operations/coverage-check.d.ts +42 -0
  30. package/dist/operations/crm-contracts-create-by-cpf-cnpj.d.ts +97 -0
  31. package/dist/operations/crm-contracts-create.d.ts +221 -0
  32. package/dist/operations/crm-contracts-list.d.ts +50 -0
  33. package/dist/operations/crm-customers-create.d.ts +155 -0
  34. package/dist/operations/crm-customers-update-status.d.ts +41 -0
  35. package/dist/operations/customers-list.d.ts +98 -0
  36. package/dist/{endpoints/ura/lookup-customer.d.ts → operations/customers-search.d.ts} +56 -46
  37. package/dist/operations/documents-add.d.ts +29 -0
  38. package/dist/operations/documents-list.d.ts +31 -0
  39. package/dist/operations/experimental-annotations-list.d.ts +67 -0
  40. package/dist/operations/invoices-list.d.ts +142 -0
  41. package/dist/operations/occurrences-create.d.ts +116 -0
  42. package/dist/operations/occurrences-list-methods.d.ts +14 -0
  43. package/dist/operations/occurrences-list-types.d.ts +20 -0
  44. package/dist/{endpoints/ura/list-plans.d.ts → operations/plans-list.d.ts} +33 -23
  45. package/dist/operations/pre-registrations-create.d.ts +253 -0
  46. package/dist/operations/pre-registrations-list-due-days.d.ts +15 -0
  47. package/dist/operations/pre-registrations-list-plans.d.ts +24 -0
  48. package/dist/operations/pre-registrations-list-sellers.d.ts +16 -0
  49. package/dist/operations/services-add-tv.d.ts +47 -0
  50. package/dist/operations/services-change-plan.d.ts +40 -0
  51. package/dist/operations/services-remove-tv.d.ts +29 -0
  52. package/dist/operations/work-orders-list-reasons.d.ts +20 -0
  53. package/dist/operations/work-orders-list.d.ts +81 -0
  54. package/dist/path.d.ts +13 -0
  55. package/dist/raw-request.d.ts +26 -0
  56. package/dist/request.d.ts +28 -0
  57. package/dist/result.d.ts +111 -43
  58. package/dist/retry.d.ts +34 -0
  59. package/dist/sensitivity.d.ts +89 -4
  60. package/dist/tolerant.d.ts +21 -0
  61. package/dist/validation.d.ts +3 -0
  62. package/package.json +6 -3
  63. package/dist/endpoint.d.ts +0 -66
  64. package/dist/endpoints/crm/address.d.ts +0 -20
  65. package/dist/endpoints/crm/create-contract.d.ts +0 -109
  66. package/dist/endpoints/crm/create-customer.d.ts +0 -65
  67. package/dist/endpoints/crm/update-customer-status.d.ts +0 -43
  68. package/dist/endpoints/os/list-occurrence-reasons.d.ts +0 -24
  69. package/dist/endpoints/os/list-occurrence-types.d.ts +0 -25
  70. package/dist/endpoints/precadastro/list-due-days.d.ts +0 -19
  71. package/dist/endpoints/precadastro/list-sellers.d.ts +0 -21
  72. package/dist/endpoints/suporte/add-customer-document.d.ts +0 -24
  73. package/dist/endpoints/suporte/list-customer-documents.d.ts +0 -25
  74. package/dist/endpoints/ura/check-coverage.d.ts +0 -46
  75. package/dist/endpoints/ura/list-clients.d.ts +0 -58
  76. package/dist/endpoints/ura/list-contracts.d.ts +0 -45
  77. package/dist/endpoints/ura/list-invoices.d.ts +0 -107
  78. package/dist/endpoints/ura/list-nas.d.ts +0 -29
  79. package/dist/endpoints/ura/list-occurrence-methods.d.ts +0 -19
  80. package/dist/endpoints/ura/list-payment-carriers.d.ts +0 -20
  81. package/dist/endpoints/ura/list-pops.d.ts +0 -19
  82. package/dist/endpoints/ura/list-service-orders.d.ts +0 -64
  83. package/dist/endpoints/ura/open-ticket.d.ts +0 -81
  84. package/dist/errors.d.ts +0 -59
  85. package/dist/schema/parse.d.ts +0 -19
  86. package/dist/schema/paths.d.ts +0 -38
  87. package/dist/transport.d.ts +0 -65
@@ -0,0 +1,14 @@
1
+ import { z } from "zod";
2
+ import type { OperationDefinition } from "../operation.js";
3
+ declare const popsSchema: z.ZodArray<z.ZodObject<{
4
+ id: z.ZodNumber;
5
+ pop: z.ZodNullable<z.ZodOptional<z.ZodString>>;
6
+ }, z.core.$loose>>;
7
+ /**
8
+ * The response of `POST /api/ura/pops/`, in SGP's own shape: a bare array with one entry per POP
9
+ * (point of presence). The route is not paginated, so there is no envelope and no total.
10
+ */
11
+ export type CatalogsListPopsData = z.output<typeof popsSchema>;
12
+ /** INTERNAL definition of `catalogs.listPops`. */
13
+ export declare const catalogsListPops: OperationDefinition<CatalogsListPopsData, "catalogs.listPops">;
14
+ export {};
@@ -0,0 +1,15 @@
1
+ import { z } from "zod";
2
+ import type { OperationDefinition } from "../operation.js";
3
+ declare const statusReasonsSchema: z.ZodArray<z.ZodObject<{
4
+ id: z.ZodNumber;
5
+ motivo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
6
+ }, z.core.$loose>>;
7
+ /**
8
+ * The response of `POST /api/ura/contrato/status/motivos/`, in SGP's own shape: a bare array of
9
+ * `{ id, motivo }`, one entry per reason the provider can register with a status change. Each
10
+ * provider has its own list. The route is not paginated, so there is no envelope and no total.
11
+ */
12
+ export type ContractsListStatusReasonsData = z.output<typeof statusReasonsSchema>;
13
+ /** INTERNAL definition of `contracts.listStatusReasons`. */
14
+ export declare const contractsListStatusReasons: OperationDefinition<ContractsListStatusReasonsData, "contracts.listStatusReasons">;
15
+ export {};
@@ -0,0 +1,52 @@
1
+ import { z } from "zod";
2
+ import type { OperationDefinition } from "../operation.js";
3
+ import type { PlanId } from "./plans-list.js";
4
+ declare const contractsSchema: z.ZodArray<z.ZodObject<{
5
+ id_contrato: z.ZodNumber;
6
+ id_cliente: z.core.$ZodBranded<z.ZodNumber, "CustomerId", "out">;
7
+ status: z.ZodNullable<z.ZodOptional<z.ZodString>>;
8
+ pop_id: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
9
+ nome: z.ZodNullable<z.ZodOptional<z.ZodString>>;
10
+ cpfcnpj: z.ZodNullable<z.ZodOptional<z.ZodString>>;
11
+ email: z.ZodNullable<z.ZodOptional<z.ZodString>>;
12
+ telefone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
13
+ data_status: z.ZodNullable<z.ZodOptional<z.ZodString>>;
14
+ data_cadastro: z.ZodNullable<z.ZodOptional<z.ZodString>>;
15
+ motivo_status: z.ZodNullable<z.ZodOptional<z.ZodString>>;
16
+ }, z.core.$loose>>;
17
+ /**
18
+ * The response of `POST /api/ura/listacontrato/`, in SGP's own shape: a bare array with one summary
19
+ * per matching contract. The route is not paginated, so there is no `paginacao`, no total and no
20
+ * envelope. An empty array means no contract matched.
21
+ */
22
+ export type ContractsListData = z.output<typeof contractsSchema>;
23
+ /** Filters of `contracts.list`, named as SGP names them. All optional. */
24
+ export interface ContractsListInput {
25
+ /** Only the contract with this id. */
26
+ contrato?: number;
27
+ /**
28
+ * Only contracts linked to this plan. The id comes from `plans.list` (the catalog of existing
29
+ * services and contracts), never from `preRegistrations.listPlans`.
30
+ */
31
+ plano?: PlanId;
32
+ /** Person type, as SGP names it (see SGP's public documentation for the values). */
33
+ tipo?: string;
34
+ /** Contract status code (see `CONTRACT_STATUS`; any number is sent). */
35
+ status?: number;
36
+ /**
37
+ * Ask SGP to include the address. The address fields were never captured: they reach `data` as
38
+ * received but untyped, and they are personal data (see `getSensitivity`; use `pick`).
39
+ */
40
+ exibir_endereco?: boolean;
41
+ }
42
+ /** INTERNAL. Validation of the input, exported so a test can check its keys are classified. */
43
+ export declare const contractsListInputSchema: z.ZodObject<{
44
+ contrato: z.ZodOptional<z.ZodNumber>;
45
+ plano: z.ZodOptional<z.ZodNumber>;
46
+ tipo: z.ZodOptional<z.ZodString>;
47
+ status: z.ZodOptional<z.ZodNumber>;
48
+ exibir_endereco: z.ZodOptional<z.ZodBoolean>;
49
+ }, z.core.$strict>;
50
+ /** INTERNAL definition of `contracts.list`. */
51
+ export declare const contractsList: OperationDefinition<ContractsListData, "contracts.list">;
52
+ export {};
@@ -0,0 +1,41 @@
1
+ import { z } from "zod";
2
+ import type { OperationDefinition } from "../operation.js";
3
+ /**
4
+ * Input of `contracts.updateStatus`, named as SGP names the fields. Both codes are sent as given:
5
+ * SGP decides what it takes and which transitions it allows.
6
+ */
7
+ export interface ContractUpdateStatusInput {
8
+ /** Exercised. ID of the contract (the `id` of `customers.list` -> `contratos[]`). */
9
+ contrato: number;
10
+ /** Exercised with 1 and 4. Status code to move to (`CONTRACT_STATUS`); any number is sent. */
11
+ status: number;
12
+ /**
13
+ * Documented, always sent in observed calls (1 and 5); a call without it was never exercised.
14
+ * ID of the reason (motivo de status) registered with the change. The list is the provider's
15
+ * own: read it with `contracts.listStatusReasons`, never assume a value. Omitted: no `motivo`
16
+ * is sent.
17
+ */
18
+ motivo?: number;
19
+ }
20
+ /** INTERNAL. Validation of the input, exported so a test can check it against the public type. */
21
+ export declare const contractsUpdateStatusInputSchema: z.ZodObject<{
22
+ contrato: z.ZodNumber;
23
+ status: z.ZodNumber;
24
+ motivo: z.ZodOptional<z.ZodNumber>;
25
+ }, z.core.$strict>;
26
+ /**
27
+ * Success body of `POST /api/ura/contrato/status/edit/`: SGP's `resposta`, which names the contract
28
+ * and the status it is in now. Other keys SGP may add are kept.
29
+ */
30
+ declare const statusChangedSchema: z.ZodObject<{
31
+ resposta: z.ZodObject<{
32
+ mensagem: z.ZodNullable<z.ZodOptional<z.ZodString>>;
33
+ contrato: z.ZodNumber;
34
+ contrato_status: z.ZodString;
35
+ }, z.core.$loose>;
36
+ }, z.core.$loose>;
37
+ /** Response of `contracts.updateStatus`. */
38
+ export type ContractUpdateStatusData = z.output<typeof statusChangedSchema>;
39
+ /** INTERNAL definition of `contracts.updateStatus`. */
40
+ export declare const contractsUpdateStatus: OperationDefinition<ContractUpdateStatusData, "contracts.updateStatus">;
41
+ export {};
@@ -0,0 +1,39 @@
1
+ import { z } from "zod";
2
+ import type { OperationDefinition } from "../operation.js";
3
+ /**
4
+ * Input of `contracts.update`. Only the field whose format and behavior are known is accepted: the
5
+ * other keys the vendor documents (`portador`, `debito_*`, `sms_desativado`, `tag_add`,
6
+ * `tag_remove`) have no known types, so they stay reachable through `request()` until documented.
7
+ */
8
+ export interface ContractUpdateInput {
9
+ /** Exercised. ID of the contract (the `id` of `customers.list` -> `contratos[]`). */
10
+ contrato: number;
11
+ /**
12
+ * Exercised with 3 and 1. Billing-method code (`BILLING_METHOD`: 1 boleto, 2 automatic debit, 3
13
+ * booklet, 4 recurring charge, 6 PIX); any number is sent as given. Code 5 appears in SGP's panel
14
+ * select for this route only and was never confirmed, so it has no constant. Changing it changes
15
+ * how the contract is billed.
16
+ */
17
+ forma_cobranca: number;
18
+ }
19
+ /** INTERNAL. Validation of the input, exported so a test can check it against the public type. */
20
+ export declare const contractsUpdateInputSchema: z.ZodObject<{
21
+ contrato: z.ZodNumber;
22
+ forma_cobranca: z.ZodNumber;
23
+ }, z.core.$strict>;
24
+ /**
25
+ * Success body of `POST /api/ura/contrato/edit/`: SGP's `resposta`, with the contract and the list
26
+ * of fields SGP says it applied (`alterados`, returned as-is). Other keys SGP may add are kept.
27
+ */
28
+ declare const contractUpdatedSchema: z.ZodObject<{
29
+ resposta: z.ZodObject<{
30
+ mensagem: z.ZodNullable<z.ZodOptional<z.ZodString>>;
31
+ contrato: z.ZodNumber;
32
+ alterados: z.ZodArray<z.ZodString>;
33
+ }, z.core.$loose>;
34
+ }, z.core.$loose>;
35
+ /** Response of `contracts.update`. */
36
+ export type ContractUpdateData = z.output<typeof contractUpdatedSchema>;
37
+ /** INTERNAL definition of `contracts.update`. */
38
+ export declare const contractsUpdate: OperationDefinition<ContractUpdateData, "contracts.update">;
39
+ export {};
@@ -0,0 +1,42 @@
1
+ import { z } from "zod";
2
+ import type { OperationDefinition } from "../operation.js";
3
+ /** Input of `coverage.check`, named as SGP names the fields. All three are required. */
4
+ export interface CoverageCheckInput {
5
+ /**
6
+ * Exercised. ID of the map gateway SGP checks against. SGP lists them at
7
+ * `/api/ura/listgatewaymapa`, which has no method here yet (use `request()`).
8
+ */
9
+ gateway: number;
10
+ /** Exercised. Search radius in meters. */
11
+ raio: number;
12
+ /**
13
+ * Exercised. The coordinate to check, `"lat,lng"` (for example `"-23.55,-46.63"`). The SDK does
14
+ * not geocode: bring the coordinate yourself. Sent as given; SGP decides what it accepts.
15
+ */
16
+ coordenada: string;
17
+ }
18
+ /** INTERNAL. Validation of the input, exported so a test can check it against the public type. */
19
+ export declare const coverageCheckInputSchema: z.ZodObject<{
20
+ gateway: z.ZodNumber;
21
+ raio: z.ZodNumber;
22
+ coordenada: z.ZodString;
23
+ }, z.core.$strict>;
24
+ declare const ctoSchema: z.ZodObject<{
25
+ lat: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
26
+ lng: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
27
+ distancia: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
28
+ id: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
29
+ nome: z.ZodNullable<z.ZodOptional<z.ZodString>>;
30
+ }, z.core.$loose>;
31
+ /** One CTO (the nearest network box) within the radius, as the gateway reports it. */
32
+ export type CoverageCto = z.output<typeof ctoSchema>;
33
+ /**
34
+ * The response of `GET /api/ura/viabilidadeinstalacao`, in SGP's own shape: an array whose
35
+ * element is an object keyed by the gateway's own name (`"SGPMaps"`, `"Geogrid"`: data-defined),
36
+ * holding either the CTOs within the radius or a message (`"Localização inviável"`) when there
37
+ * are none. Nothing is converted: Geogrid's numeric strings stay strings.
38
+ */
39
+ export type CoverageCheckData = Array<Record<string, string | CoverageCto[]>>;
40
+ /** INTERNAL definition of `coverage.check`. */
41
+ export declare const coverageCheck: OperationDefinition<CoverageCheckData, "coverage.check">;
42
+ export {};
@@ -0,0 +1,97 @@
1
+ import type { OperationDefinition } from "../operation.js";
2
+ import { type CrmContractCreateData, type CrmContractCreateInput } from "./crm-contracts-create.js";
3
+ /**
4
+ * Input of `crm.contracts.createByCpfCnpj`: the contract of `crm.contracts.create`
5
+ * (see `CrmContractCreateInput` for every field and whether it was exercised) addressed by the
6
+ * customer's document instead of the customer id, so there is no `cliente_id`. The "Exercised"
7
+ * markers of those fields come from the by-id route: NO field of this input ever reached a success
8
+ * on this route (its only live call was refused).
9
+ */
10
+ export interface CrmContractCreateByCpfCnpjInput extends Omit<CrmContractCreateInput, "cliente_id"> {
11
+ /**
12
+ * Exercised (live, with a CPF in digits only). Required. The document of the CRM customer, sent
13
+ * in the query string of the POST as `cpfcnpj`, SGP's own name for a field that takes either
14
+ * kind: the API decides whether it is a CPF or a CNPJ. Only a CPF was ever sent; a CNPJ is
15
+ * accepted by the field's name and was never exercised. Sent as given: digits or formatted
16
+ * (`123.456.789-00`). Personal data: never log it.
17
+ */
18
+ cpfcnpj: string;
19
+ }
20
+ /** INTERNAL. Validation of the input, exported so a test can check it against the public type. */
21
+ export declare const crmContractsCreateByCpfCnpjInputSchema: import("zod").ZodObject<{
22
+ pop_id: import("zod").ZodNumber;
23
+ plano_id: import("zod/v4/core").$ZodBranded<import("zod").ZodNumber, "PlanId", "out">;
24
+ portador_id: import("zod").ZodNumber;
25
+ forma_cobranca_codigo: import("zod").ZodNumber;
26
+ vencimento_dia: import("zod").ZodNumber;
27
+ endereco_instalacao: import("zod").ZodObject<{
28
+ numero: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
29
+ complemento: import("zod").ZodOptional<import("zod").ZodString>;
30
+ pais: import("zod").ZodOptional<import("zod").ZodString>;
31
+ pontoreferencia: import("zod").ZodOptional<import("zod").ZodString>;
32
+ map_ll: import("zod").ZodOptional<import("zod").ZodString>;
33
+ condominio: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
34
+ logradouro: import("zod").ZodString;
35
+ bairro: import("zod").ZodString;
36
+ cidade: import("zod").ZodString;
37
+ cep: import("zod").ZodString;
38
+ uf: import("zod").ZodString;
39
+ }, import("zod/v4/core").$strict>;
40
+ endereco_cobranca: import("zod").ZodObject<{
41
+ numero: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
42
+ complemento: import("zod").ZodOptional<import("zod").ZodString>;
43
+ pais: import("zod").ZodOptional<import("zod").ZodString>;
44
+ pontoreferencia: import("zod").ZodOptional<import("zod").ZodString>;
45
+ map_ll: import("zod").ZodOptional<import("zod").ZodString>;
46
+ condominio: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
47
+ logradouro: import("zod").ZodString;
48
+ bairro: import("zod").ZodString;
49
+ cidade: import("zod").ZodString;
50
+ cep: import("zod").ZodString;
51
+ uf: import("zod").ZodString;
52
+ }, import("zod/v4/core").$strict>;
53
+ login: import("zod").ZodOptional<import("zod").ZodString>;
54
+ senha: import("zod").ZodOptional<import("zod").ZodString>;
55
+ modoaquisicao: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodLiteral<0>, import("zod").ZodLiteral<1>]>>;
56
+ nas: import("zod").ZodOptional<import("zod").ZodString>;
57
+ isento: import("zod").ZodOptional<import("zod").ZodNumber>;
58
+ autocobranca: import("zod").ZodOptional<import("zod").ZodBoolean>;
59
+ servicodesc: import("zod").ZodOptional<import("zod").ZodString>;
60
+ observacao: import("zod").ZodOptional<import("zod").ZodString>;
61
+ vendedor_id: import("zod").ZodOptional<import("zod").ZodNumber>;
62
+ comissao_tipo: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodLiteral<1>, import("zod").ZodLiteral<2>]>>;
63
+ comissao: import("zod").ZodOptional<import("zod").ZodNumber>;
64
+ contrato_id: import("zod").ZodOptional<import("zod").ZodNumber>;
65
+ fidelidade_id: import("zod").ZodOptional<import("zod").ZodNumber>;
66
+ midia_id: import("zod").ZodOptional<import("zod").ZodNumber>;
67
+ central_login: import("zod").ZodOptional<import("zod").ZodString>;
68
+ central_senha: import("zod").ZodOptional<import("zod").ZodString>;
69
+ ip: import("zod").ZodOptional<import("zod").ZodString>;
70
+ ippool_id: import("zod").ZodOptional<import("zod").ZodNumber>;
71
+ mac_dhcp: import("zod").ZodOptional<import("zod").ZodString>;
72
+ mac: import("zod").ZodOptional<import("zod").ZodString>;
73
+ logins_simult: import("zod").ZodOptional<import("zod").ZodNumber>;
74
+ splitter_id: import("zod").ZodOptional<import("zod").ZodNumber>;
75
+ splitter_port: import("zod").ZodOptional<import("zod").ZodNumber>;
76
+ tipo_equipamento: import("zod").ZodOptional<import("zod").ZodString>;
77
+ usuarioalt_id: import("zod").ZodOptional<import("zod").ZodNumber>;
78
+ os_instalacao: import("zod").ZodOptional<import("zod").ZodBoolean>;
79
+ conteudo: import("zod").ZodOptional<import("zod").ZodString>;
80
+ instalacao_quantidade_parcelas: import("zod").ZodOptional<import("zod").ZodNumber>;
81
+ instalacao_preco: import("zod").ZodOptional<import("zod").ZodNumber>;
82
+ instalacao_desconto: import("zod").ZodOptional<import("zod").ZodNumber>;
83
+ instalacao_entrada: import("zod").ZodOptional<import("zod").ZodNumber>;
84
+ instalacao_entrada_forma: import("zod").ZodOptional<import("zod").ZodNumber>;
85
+ instalacao_parcela_forma: import("zod").ZodOptional<import("zod").ZodNumber>;
86
+ instalacao_portador: import("zod").ZodOptional<import("zod").ZodNumber>;
87
+ cpfcnpj: import("zod").ZodString;
88
+ }, import("zod/v4/core").$strict>;
89
+ /**
90
+ * Response of `crm.contracts.createByCpfCnpj`. DOCUMENTED, NOT OBSERVED: the only call ever made to
91
+ * this route was refused (400), so a success was never seen. It is assumed to answer like
92
+ * `crm.contracts.create` (`{ message, clientecontrato, cliente }`), which is what the vendor's
93
+ * route family does; a 2xx without a numeric `clientecontrato` is `INVALID_RESPONSE`.
94
+ */
95
+ export type CrmContractCreateByCpfCnpjData = CrmContractCreateData;
96
+ /** INTERNAL definition of `crm.contracts.createByCpfCnpj`. */
97
+ export declare const crmContractsCreateByCpfCnpj: OperationDefinition<CrmContractCreateByCpfCnpjData, "crm.contracts.createByCpfCnpj">;
@@ -0,0 +1,221 @@
1
+ import { z } from "zod";
2
+ import { type SgpAddress } from "../address.js";
3
+ import type { AcquisitionMode } from "../constants.js";
4
+ import { type CustomerId } from "../ids.js";
5
+ import type { OperationDefinition } from "../operation.js";
6
+ import type { OperationSensitivity } from "../sensitivity.js";
7
+ import type { PlanId } from "./plans-list.js";
8
+ /** The address of a CRM contract: the vendor requires these five keys, for both addresses. */
9
+ interface CrmContractAddress extends SgpAddress {
10
+ logradouro: string;
11
+ bairro: string;
12
+ cidade: string;
13
+ cep: string;
14
+ uf: string;
15
+ }
16
+ /**
17
+ * Input of `crm.contracts.create`, named as SGP names the fields. Only the fields the vendor's
18
+ * documentation marks as required are required here; the rest is optional. Each field says
19
+ * "Exercised" when a live call sent it (a live contract call and the 1.x live-tested contract) or
20
+ * "Documented" when only the vendor's documentation lists it and it was never sent.
21
+ */
22
+ export interface CrmContractCreateInput {
23
+ /** ID of the CRM customer (the `cliente_id` of `crm.customers.create`). Goes in the path. */
24
+ cliente_id: CustomerId;
25
+ /** Exercised. Required. POP ID. */
26
+ pop_id: number;
27
+ /** Exercised. Required. Plan ID of the URA catalog (`plans.list`), a `PlanId`. */
28
+ plano_id: PlanId;
29
+ /** Exercised. Required. Payer or financial responsible (billing profile, `portador`) ID. */
30
+ portador_id: number;
31
+ /**
32
+ * Exercised with 1. Required. Billing-method code (`BILLING_METHOD`: 1 boleto, 2 automatic debit, 3 booklet, 4
33
+ * recurring charge, 6 PIX); any number is sent as given.
34
+ */
35
+ forma_cobranca_codigo: number;
36
+ /** Exercised. Required. Due day of the month (a day, not an ID). */
37
+ vencimento_dia: number;
38
+ /** Exercised. Required. Sent nested (`endereco_instalacao`) and also as loose fields, as SGP reads both. */
39
+ endereco_instalacao: CrmContractAddress;
40
+ /** Exercised. Required. Sent nested (`endereco_cobranca`) only. */
41
+ endereco_cobranca: CrmContractAddress;
42
+ /**
43
+ * Exercised. PPPoE login. The vendor requires it, with `senha` and `modoaquisicao`, for an
44
+ * Internet service; the SDK cannot tell a plan's type, so it leaves them optional (the refusal
45
+ * for their absence was never observed). Secret: never log it.
46
+ */
47
+ login?: string;
48
+ /** Exercised. PPPoE password; see `login`. Secret: never log it. */
49
+ senha?: string;
50
+ /**
51
+ * Exercised with 1. Equipment situation: `ACQUISITION_MODE` (0 owned, 1 loan), the constant shared with
52
+ * `preRegistrations.create`. The vendor's CRM documentation lists 1 and 2, but SGP refused 2 on
53
+ * this route (live, 31/10: `{ errors: { modoaquisicao: "Modo de aquisição inválido." } }`); no
54
+ * other value is known to be valid, so the SDK accepts only 0 and 1.
55
+ */
56
+ modoaquisicao?: AcquisitionMode;
57
+ /**
58
+ * Exercised. NAS name (text, not `nas_id`). SGP requires it for an Internet service (live: 400
59
+ * `{ errors: { nas: "O campo 'nas' é obrigatório para serviço de Internet." } }`).
60
+ */
61
+ nas?: string;
62
+ /** Exercised with 100. Exempt percentage. */
63
+ isento?: number;
64
+ /** Exercised with `false`. Whether SGP charges the contract automatically. */
65
+ autocobranca?: boolean;
66
+ /** Documented. Details of the requested service. Free text: personal data. */
67
+ servicodesc?: string;
68
+ /** Documented. Free-text note. Personal data. */
69
+ observacao?: string;
70
+ /** Documented. Seller ID. */
71
+ vendedor_id?: number;
72
+ /** Documented. `1` percentage, `2` fixed amount. */
73
+ comissao_tipo?: 1 | 2;
74
+ /** Documented. Commission, in the unit of `comissao_tipo`. */
75
+ comissao?: number;
76
+ /** Documented. Contract group for printing. */
77
+ contrato_id?: number;
78
+ /** Documented. Loyalty (fidelidade) ID. */
79
+ fidelidade_id?: number;
80
+ /** Documented. "How did you hear about us" ID. */
81
+ midia_id?: number;
82
+ /** Documented. Login of the customer's central. Secret: never log it. */
83
+ central_login?: string;
84
+ /** Documented. Password of the customer's central. Secret: never log it. */
85
+ central_senha?: string;
86
+ /** Documented. Fixed IP of the contract. Network identifier: secret. */
87
+ ip?: string;
88
+ /** Documented. IP pool ID. */
89
+ ippool_id?: number;
90
+ /** Documented. MAC address for DHCP. Network identifier: secret. */
91
+ mac_dhcp?: string;
92
+ /** Documented. MAC address of the equipment. Network identifier: secret. */
93
+ mac?: string;
94
+ /** Documented. Number of simultaneous logins. */
95
+ logins_simult?: number;
96
+ /** Documented. Splitter ID. */
97
+ splitter_id?: number;
98
+ /** Documented. Splitter port. */
99
+ splitter_port?: number;
100
+ /** Documented. Equipment type. */
101
+ tipo_equipamento?: string;
102
+ /** Documented. ID of the user responsible for the change. */
103
+ usuarioalt_id?: number;
104
+ /** Exercised with `true`. Opens the installation work order, without a date. */
105
+ os_instalacao?: boolean;
106
+ /** Exercised. Text of the installation occurrence. */
107
+ conteudo?: string;
108
+ /** Exercised with 0. Number of installments of the installation. */
109
+ instalacao_quantidade_parcelas?: number;
110
+ /** Exercised with 0. Installation price, in reais. */
111
+ instalacao_preco?: number;
112
+ /** Documented. Discount over the installation price. */
113
+ instalacao_desconto?: number;
114
+ /** Documented. Down payment of the installation. */
115
+ instalacao_entrada?: number;
116
+ /** Documented. Payment form of the down payment. */
117
+ instalacao_entrada_forma?: number;
118
+ /** Documented. Payment form of the installments. */
119
+ instalacao_parcela_forma?: number;
120
+ /** Documented. Billing profile (portador) ID of the installation. */
121
+ instalacao_portador?: number;
122
+ }
123
+ /** INTERNAL. Validation of the input, exported so a test can check it against the public type. */
124
+ export declare const crmContractsCreateInputSchema: z.ZodObject<{
125
+ cliente_id: z.core.$ZodBranded<z.ZodNumber, "CustomerId", "out">;
126
+ pop_id: z.ZodNumber;
127
+ plano_id: z.core.$ZodBranded<z.ZodNumber, "PlanId", "out">;
128
+ portador_id: z.ZodNumber;
129
+ forma_cobranca_codigo: z.ZodNumber;
130
+ vencimento_dia: z.ZodNumber;
131
+ endereco_instalacao: z.ZodObject<{
132
+ numero: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
133
+ complemento: z.ZodOptional<z.ZodString>;
134
+ pais: z.ZodOptional<z.ZodString>;
135
+ pontoreferencia: z.ZodOptional<z.ZodString>;
136
+ map_ll: z.ZodOptional<z.ZodString>;
137
+ condominio: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
138
+ logradouro: z.ZodString;
139
+ bairro: z.ZodString;
140
+ cidade: z.ZodString;
141
+ cep: z.ZodString;
142
+ uf: z.ZodString;
143
+ }, z.core.$strict>;
144
+ endereco_cobranca: z.ZodObject<{
145
+ numero: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
146
+ complemento: z.ZodOptional<z.ZodString>;
147
+ pais: z.ZodOptional<z.ZodString>;
148
+ pontoreferencia: z.ZodOptional<z.ZodString>;
149
+ map_ll: z.ZodOptional<z.ZodString>;
150
+ condominio: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
151
+ logradouro: z.ZodString;
152
+ bairro: z.ZodString;
153
+ cidade: z.ZodString;
154
+ cep: z.ZodString;
155
+ uf: z.ZodString;
156
+ }, z.core.$strict>;
157
+ login: z.ZodOptional<z.ZodString>;
158
+ senha: z.ZodOptional<z.ZodString>;
159
+ modoaquisicao: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
160
+ nas: z.ZodOptional<z.ZodString>;
161
+ isento: z.ZodOptional<z.ZodNumber>;
162
+ autocobranca: z.ZodOptional<z.ZodBoolean>;
163
+ servicodesc: z.ZodOptional<z.ZodString>;
164
+ observacao: z.ZodOptional<z.ZodString>;
165
+ vendedor_id: z.ZodOptional<z.ZodNumber>;
166
+ comissao_tipo: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
167
+ comissao: z.ZodOptional<z.ZodNumber>;
168
+ contrato_id: z.ZodOptional<z.ZodNumber>;
169
+ fidelidade_id: z.ZodOptional<z.ZodNumber>;
170
+ midia_id: z.ZodOptional<z.ZodNumber>;
171
+ central_login: z.ZodOptional<z.ZodString>;
172
+ central_senha: z.ZodOptional<z.ZodString>;
173
+ ip: z.ZodOptional<z.ZodString>;
174
+ ippool_id: z.ZodOptional<z.ZodNumber>;
175
+ mac_dhcp: z.ZodOptional<z.ZodString>;
176
+ mac: z.ZodOptional<z.ZodString>;
177
+ logins_simult: z.ZodOptional<z.ZodNumber>;
178
+ splitter_id: z.ZodOptional<z.ZodNumber>;
179
+ splitter_port: z.ZodOptional<z.ZodNumber>;
180
+ tipo_equipamento: z.ZodOptional<z.ZodString>;
181
+ usuarioalt_id: z.ZodOptional<z.ZodNumber>;
182
+ os_instalacao: z.ZodOptional<z.ZodBoolean>;
183
+ conteudo: z.ZodOptional<z.ZodString>;
184
+ instalacao_quantidade_parcelas: z.ZodOptional<z.ZodNumber>;
185
+ instalacao_preco: z.ZodOptional<z.ZodNumber>;
186
+ instalacao_desconto: z.ZodOptional<z.ZodNumber>;
187
+ instalacao_entrada: z.ZodOptional<z.ZodNumber>;
188
+ instalacao_entrada_forma: z.ZodOptional<z.ZodNumber>;
189
+ instalacao_parcela_forma: z.ZodOptional<z.ZodNumber>;
190
+ instalacao_portador: z.ZodOptional<z.ZodNumber>;
191
+ }, z.core.$strict>;
192
+ /**
193
+ * INTERNAL. The JSON body of a CRM contract, shared by the two routes that take it: both addresses
194
+ * nested, the installation one also as loose fields beside them (as 1.x). `fields` is the validated
195
+ * input without the customer reference (the path id of this route, the query document of the other).
196
+ */
197
+ export declare const crmContractBody: ({ endereco_instalacao, endereco_cobranca, ...fields }: Omit<z.output<typeof crmContractsCreateInputSchema>, "cliente_id">) => Record<string, unknown>;
198
+ /**
199
+ * Success body of `POST /api/crm/cliente/{cliente_id}/contratos/`: SGP's `message`, the new
200
+ * contract's id (`clientecontrato`) and the customer's name. Other keys SGP may add are kept.
201
+ * INTERNAL: `crm.contracts.createByCpfCnpj` takes the same shape (documented, never observed there).
202
+ */
203
+ export declare const crmContractCreatedSchema: z.ZodObject<{
204
+ message: z.ZodNullable<z.ZodOptional<z.ZodString>>;
205
+ clientecontrato: z.ZodNumber;
206
+ cliente: z.ZodNullable<z.ZodOptional<z.ZodString>>;
207
+ }, z.core.$loose>;
208
+ /** The one key a 200 must have to be taken as the creation answer. */
209
+ export declare const crmContractCreatedInvariants: readonly ["clientecontrato"];
210
+ /** Response of `crm.contracts.create`. */
211
+ export type CrmContractCreateData = z.output<typeof crmContractCreatedSchema>;
212
+ /**
213
+ * PPPoE and Central logins and passwords and the network identifiers (IP, MAC) are secrets; the
214
+ * addresses, the free texts and the customer's name in the 200 are personal. The rest are ids,
215
+ * codes, flags and money. INTERNAL: shared with `crm.contracts.createByCpfCnpj`, which sends the
216
+ * same body.
217
+ */
218
+ export declare const crmContractsCreateSensitivity: OperationSensitivity;
219
+ /** INTERNAL definition of `crm.contracts.create`. */
220
+ export declare const crmContractsCreate: OperationDefinition<CrmContractCreateData, "crm.contracts.create">;
221
+ export {};
@@ -0,0 +1,50 @@
1
+ import { z } from "zod";
2
+ import type { OperationDefinition } from "../operation.js";
3
+ /** Input of `crm.contracts.list`, named as SGP names the field. */
4
+ export interface CrmContractsListInput {
5
+ /**
6
+ * Exercised (live, with a CPF in digits only). Required. The document of the CRM customer, sent as
7
+ * `cpfcnpj`, SGP's own name for a field that takes either kind: the API decides whether it is a
8
+ * CPF or a CNPJ. Only a CPF was ever sent; a CNPJ is accepted by the field's name and was never
9
+ * exercised. Sent as given: digits or formatted (`123.456.789-00`). Personal data: never log it.
10
+ */
11
+ cpfcnpj: string;
12
+ }
13
+ /** INTERNAL. Validation of the input, exported so a test can check it against the public type. */
14
+ export declare const crmContractsListInputSchema: z.ZodObject<{
15
+ cpfcnpj: z.ZodString;
16
+ }, z.core.$strict>;
17
+ declare const contractsSchema: z.ZodObject<{
18
+ cliente: z.ZodNullable<z.ZodOptional<z.ZodString>>;
19
+ cpf_cnpj: z.ZodNullable<z.ZodOptional<z.ZodString>>;
20
+ contratos: z.ZodArray<z.ZodObject<{
21
+ cliente_contrato_id: z.ZodNumber;
22
+ data_cadastro: z.ZodNullable<z.ZodOptional<z.ZodString>>;
23
+ vencimento_dia: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
24
+ pop: z.ZodNullable<z.ZodOptional<z.ZodString>>;
25
+ endereco: z.ZodNullable<z.ZodOptional<z.ZodString>>;
26
+ forma_cobranca: z.ZodNullable<z.ZodOptional<z.ZodString>>;
27
+ status: z.ZodNullable<z.ZodOptional<z.ZodString>>;
28
+ data_status: z.ZodNullable<z.ZodOptional<z.ZodString>>;
29
+ modo_status: z.ZodNullable<z.ZodOptional<z.ZodString>>;
30
+ motivo_status: z.ZodNullable<z.ZodOptional<z.ZodString>>;
31
+ vendedor: z.ZodNullable<z.ZodOptional<z.ZodString>>;
32
+ servicos: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
33
+ plano: z.ZodNullable<z.ZodOptional<z.ZodString>>;
34
+ login: z.ZodNullable<z.ZodOptional<z.ZodString>>;
35
+ contrato_tipo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
36
+ situacao: z.ZodNullable<z.ZodOptional<z.ZodString>>;
37
+ aquisicao: z.ZodNullable<z.ZodOptional<z.ZodString>>;
38
+ }, z.core.$loose>>>>;
39
+ }, z.core.$loose>>;
40
+ }, z.core.$loose>;
41
+ /**
42
+ * Response of `GET /api/crm/cliente/contratos/`, in SGP's own shape: the customer's `cliente` and
43
+ * `cpf_cnpj` (personal data) and `contratos`, one summary per contract, empty when the CRM customer
44
+ * has none. `data_cadastro` and `data_status` are `DD/MM/AAAA` strings, kept as SGP writes them.
45
+ * Unknown keys reach `data` as received.
46
+ */
47
+ export type CrmContractsListData = z.output<typeof contractsSchema>;
48
+ /** INTERNAL definition of `crm.contracts.list`. */
49
+ export declare const crmContractsList: OperationDefinition<CrmContractsListData, "crm.contracts.list">;
50
+ export {};