@77sol-ui/form-schemas 1.0.0

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 (50) hide show
  1. package/README.md +166 -0
  2. package/package.json +61 -0
  3. package/src/domains/financing/enums/banks.ts +22 -0
  4. package/src/domains/financing/enums/index.ts +2 -0
  5. package/src/domains/financing/enums/occupation.ts +2 -0
  6. package/src/domains/financing/formalization/extras.ts +21 -0
  7. package/src/domains/financing/formalization/index.ts +16 -0
  8. package/src/domains/financing/formalization/refinements.ts +70 -0
  9. package/src/domains/financing/formalization/registry.ts +114 -0
  10. package/src/domains/financing/formalization/schemas/AlfaPFSchema.ts +46 -0
  11. package/src/domains/financing/formalization/schemas/AlfaPJSchema.ts +65 -0
  12. package/src/domains/financing/formalization/schemas/BancoDoBrasilPFSchema.ts +46 -0
  13. package/src/domains/financing/formalization/schemas/BancoDoBrasilPJSchema.ts +65 -0
  14. package/src/domains/financing/formalization/schemas/BtgPFSchema.ts +46 -0
  15. package/src/domains/financing/formalization/schemas/BtgPJSchema.ts +77 -0
  16. package/src/domains/financing/formalization/schemas/BvPFSchema.ts +59 -0
  17. package/src/domains/financing/formalization/schemas/BvPJSchema.ts +84 -0
  18. package/src/domains/financing/formalization/schemas/CaixaEconomicaFederalPFSchema.ts +48 -0
  19. package/src/domains/financing/formalization/schemas/CaixaEconomicaFederalPJSchema.ts +67 -0
  20. package/src/domains/financing/formalization/schemas/CashMePFSchema.ts +46 -0
  21. package/src/domains/financing/formalization/schemas/CashMePJSchema.ts +65 -0
  22. package/src/domains/financing/formalization/schemas/Credito77PFSchema.ts +46 -0
  23. package/src/domains/financing/formalization/schemas/Credito77PJSchema.ts +65 -0
  24. package/src/domains/financing/formalization/schemas/EosPFSchema.ts +46 -0
  25. package/src/domains/financing/formalization/schemas/EosPJSchema.ts +65 -0
  26. package/src/domains/financing/formalization/schemas/HdtEnergyPFSchema.ts +46 -0
  27. package/src/domains/financing/formalization/schemas/HdtEnergyPJSchema.ts +65 -0
  28. package/src/domains/financing/formalization/schemas/LosangoPFSchema.ts +46 -0
  29. package/src/domains/financing/formalization/schemas/LosangoPJSchema.ts +65 -0
  30. package/src/domains/financing/formalization/schemas/SafraPFSchema.ts +46 -0
  31. package/src/domains/financing/formalization/schemas/SafraPJSchema.ts +65 -0
  32. package/src/domains/financing/formalization/schemas/SantanderPFSchema.ts +46 -0
  33. package/src/domains/financing/formalization/schemas/SantanderPJSchema.ts +65 -0
  34. package/src/domains/financing/formalization/schemas/SolAgoraPFSchema.ts +46 -0
  35. package/src/domains/financing/formalization/schemas/SolAgoraPJSchema.ts +75 -0
  36. package/src/domains/financing/formalization/schemas/SolfacilPFSchema.ts +46 -0
  37. package/src/domains/financing/formalization/schemas/SolfacilPJSchema.ts +70 -0
  38. package/src/domains/financing/formalization/uiMeta.ts +122 -0
  39. package/src/domains/financing/index.ts +1 -0
  40. package/src/index.ts +1 -0
  41. package/src/shared/enums/document-type.ts +4 -0
  42. package/src/shared/enums/index.ts +3 -0
  43. package/src/shared/enums/nationality.ts +2 -0
  44. package/src/shared/enums/sex.ts +4 -0
  45. package/src/shared/fields/index.ts +1 -0
  46. package/src/shared/fields/primitives.ts +32 -0
  47. package/src/shared/regex/index.ts +75 -0
  48. package/src/shared/regex/patterns.ts +15 -0
  49. package/src/shared/regex/validators.spec.ts +162 -0
  50. package/src/shared/regex/validators.ts +96 -0
@@ -0,0 +1,65 @@
1
+ import { z } from 'zod'
2
+ import { SexEnum } from '../../../../shared/enums'
3
+ import { textField } from '../../../../shared/fields/primitives'
4
+ import {
5
+ birthDateSchema,
6
+ cepSchema,
7
+ cnpjSchema,
8
+ cpfSchema,
9
+ currencySchema,
10
+ emailSchema,
11
+ issueDateSchema,
12
+ phoneBRSchema,
13
+ } from '../../../../shared/regex'
14
+ import { formalizationExtras } from '../extras'
15
+ import { applyPjRefinements } from '../refinements'
16
+
17
+ export const bancoDoBrasilPjObject = z.object({
18
+ ...formalizationExtras,
19
+ financing_company: z
20
+ .object({
21
+ corporate_name: textField(),
22
+ cep: cepSchema,
23
+ address: textField(),
24
+ foundation_date: issueDateSchema,
25
+ number: textField(),
26
+ cnpj: cnpjSchema,
27
+ email: emailSchema,
28
+ complement: textField(15).optional(),
29
+ phone: phoneBRSchema,
30
+ district: textField(),
31
+ legal_nature: textField(),
32
+ city: textField(),
33
+ economic_activity_group: textField(),
34
+ state: textField(2),
35
+ economic_activity: textField(),
36
+ monthly_income: currencySchema,
37
+ })
38
+ .strict(),
39
+ financing_company_guarantor: z.array(
40
+ z
41
+ .object({
42
+ name: textField(),
43
+ cep: cepSchema,
44
+ cpf: cpfSchema,
45
+ address: textField(),
46
+ birth_date: birthDateSchema,
47
+ number: textField(),
48
+ complement: textField(15).optional(),
49
+ cellphone: phoneBRSchema,
50
+ email: emailSchema,
51
+ district: textField(),
52
+ sex: SexEnum,
53
+ city: textField(),
54
+ state: textField(2),
55
+ office: textField(),
56
+ mother_name: textField(),
57
+ nationality: textField(),
58
+ })
59
+ .strict(),
60
+ ),
61
+ })
62
+
63
+ export const bancoDoBrasilPjSchema = bancoDoBrasilPjObject.strict().superRefine(applyPjRefinements)
64
+
65
+ export type BancoDoBrasilPjFicha = z.infer<typeof bancoDoBrasilPjSchema>
@@ -0,0 +1,46 @@
1
+ import { z } from 'zod'
2
+ import { DocumentTypeEnum, SexEnum } from '../../../../shared/enums'
3
+ import { textField } from '../../../../shared/fields/primitives'
4
+ import {
5
+ birthDateSchema,
6
+ cepSchema,
7
+ cpfCnpjSchema,
8
+ cpfSchema,
9
+ currencySchema,
10
+ emailSchema,
11
+ issueDateSchema,
12
+ phoneBRSchema,
13
+ } from '../../../../shared/regex'
14
+ import { formalizationExtras } from '../extras'
15
+ import { applyPfRefinements } from '../refinements'
16
+
17
+ export const btgPfObject = z.object({
18
+ ...formalizationExtras,
19
+ name: textField(),
20
+ cep: cepSchema,
21
+ cpf: cpfSchema,
22
+ address: textField(),
23
+ birth_date: birthDateSchema,
24
+ number: textField(),
25
+ sex: SexEnum,
26
+ complement: textField(15).optional(),
27
+ mother_name: textField(),
28
+ district: textField(),
29
+ energy_account_in_requester_name: textField(),
30
+ city: textField(),
31
+ energy_bill_owner_document: cpfCnpjSchema.optional(),
32
+ state: textField(2),
33
+ nationality: textField(),
34
+ cellphone: phoneBRSchema,
35
+ email: emailSchema,
36
+ monthly_income: currencySchema,
37
+ profession: textField(),
38
+ type_doc: DocumentTypeEnum,
39
+ doc: textField(15),
40
+ issuing_body: textField(6),
41
+ doc_issue_date: issueDateSchema,
42
+ })
43
+
44
+ export const btgPfSchema = btgPfObject.strict().superRefine(applyPfRefinements)
45
+
46
+ export type BtgPfFicha = z.infer<typeof btgPfSchema>
@@ -0,0 +1,77 @@
1
+ import { z } from 'zod'
2
+ import { DocumentTypeEnum, SexEnum } from '../../../../shared/enums'
3
+ import { textField } from '../../../../shared/fields/primitives'
4
+ import {
5
+ birthDateSchema,
6
+ cepSchema,
7
+ cnpjSchema,
8
+ cpfSchema,
9
+ currencySchema,
10
+ dateDMYSchema,
11
+ emailSchema,
12
+ issueDateSchema,
13
+ phoneBRSchema,
14
+ } from '../../../../shared/regex'
15
+ import { formalizationExtras } from '../extras'
16
+ import { applyPjRefinements } from '../refinements'
17
+
18
+ export const btgPjObject = z.object({
19
+ ...formalizationExtras,
20
+ financing_company: z
21
+ .object({
22
+ corporate_name: textField(),
23
+ cep: cepSchema,
24
+ address: textField(),
25
+ foundation_date: issueDateSchema,
26
+ number: textField(),
27
+ cnpj: cnpjSchema,
28
+ email: emailSchema,
29
+ complement: textField(15).optional(),
30
+ phone: phoneBRSchema,
31
+ district: textField(),
32
+ legal_nature: textField(),
33
+ city: textField(),
34
+ economic_activity_group: textField(),
35
+ state: textField(2),
36
+ economic_activity: textField(),
37
+ monthly_income: currencySchema,
38
+ })
39
+ .strict(),
40
+ financing_company_guarantor: z.array(
41
+ z
42
+ .object({
43
+ name: textField(),
44
+ cep: cepSchema,
45
+ cpf: cpfSchema,
46
+ address: textField(),
47
+ birth_date: birthDateSchema,
48
+ number: textField(),
49
+ complement: textField(15).optional(),
50
+ cellphone: phoneBRSchema,
51
+ phone: phoneBRSchema,
52
+ email: emailSchema,
53
+ district: textField(),
54
+ sex: SexEnum,
55
+ city: textField(),
56
+ state: textField(2),
57
+ civil_status: textField(),
58
+ office: textField(),
59
+ type_doc: DocumentTypeEnum,
60
+ doc: textField(),
61
+ issuing_body: textField(),
62
+ uf_issuing_body: textField(2),
63
+ doc_issue_date: issueDateSchema,
64
+ doc_expiration_date: dateDMYSchema,
65
+ mother_name: textField(),
66
+ monthly_income: currencySchema,
67
+ patrimony: currencySchema,
68
+ uf_naturalness: textField(2),
69
+ nationality: textField(),
70
+ })
71
+ .strict(),
72
+ ),
73
+ })
74
+
75
+ export const btgPjSchema = btgPjObject.strict().superRefine(applyPjRefinements)
76
+
77
+ export type BtgPjFicha = z.infer<typeof btgPjSchema>
@@ -0,0 +1,59 @@
1
+ import { z } from 'zod'
2
+ import { DocumentTypeEnum, SexEnum } from '../../../../shared/enums'
3
+ import { integerField, numberField, textField } from '../../../../shared/fields/primitives'
4
+ import {
5
+ birthDateSchema,
6
+ cepSchema,
7
+ cnpjSchema,
8
+ cpfCnpjSchema,
9
+ cpfSchema,
10
+ currencySchema,
11
+ emailSchema,
12
+ issueDateSchema,
13
+ phoneBRSchema,
14
+ } from '../../../../shared/regex'
15
+ import { formalizationExtras } from '../extras'
16
+ import { applyPfRefinements } from '../refinements'
17
+
18
+ export const bvPfObject = z.object({
19
+ ...formalizationExtras,
20
+ name: textField(),
21
+ cep: cepSchema,
22
+ residence_situation: textField(),
23
+ cpf: cpfSchema,
24
+ address: textField(),
25
+ months_in_residence: integerField,
26
+ birth_date: birthDateSchema,
27
+ number: textField(),
28
+ sex: SexEnum,
29
+ complement: textField(15).optional(),
30
+ is_installation_at_requester: textField(),
31
+ mother_name: textField(),
32
+ district: textField(),
33
+ energy_account_in_requester_name: textField(),
34
+ city: textField(),
35
+ energy_bill_owner_document: cpfCnpjSchema.optional(),
36
+ civil_status: textField(),
37
+ state: textField(2),
38
+ nationality: textField(),
39
+ uf_naturalness: textField(2),
40
+ naturalness: textField(),
41
+ cellphone: phoneBRSchema,
42
+ email: emailSchema,
43
+ monthly_income: currencySchema,
44
+ profession: textField(),
45
+ nature_of_occupation: textField(),
46
+ company_time: numberField,
47
+ cnpj_proprietary: cnpjSchema.optional(),
48
+ equity_value: currencySchema,
49
+ type_doc: DocumentTypeEnum,
50
+ doc: textField(15),
51
+ issuing_body: textField(6),
52
+ emitting_state: textField(2),
53
+ doc_issue_date: issueDateSchema,
54
+ pep_relationship: textField().optional(),
55
+ })
56
+
57
+ export const bvPfSchema = bvPfObject.strict().superRefine(applyPfRefinements)
58
+
59
+ export type BvPfFicha = z.infer<typeof bvPfSchema>
@@ -0,0 +1,84 @@
1
+ import { z } from 'zod'
2
+ import { DocumentTypeEnum, SexEnum } from '../../../../shared/enums'
3
+ import { integerField, textField } from '../../../../shared/fields/primitives'
4
+ import {
5
+ birthDateSchema,
6
+ cepSchema,
7
+ cnpjSchema,
8
+ cpfSchema,
9
+ currencySchema,
10
+ dateDMYSchema,
11
+ emailSchema,
12
+ issueDateSchema,
13
+ phoneBRSchema,
14
+ } from '../../../../shared/regex'
15
+ import { formalizationExtras } from '../extras'
16
+ import { applyPjRefinements } from '../refinements'
17
+
18
+ export const bvPjObject = z.object({
19
+ ...formalizationExtras,
20
+ financing_company: z
21
+ .object({
22
+ corporate_name: textField(),
23
+ cep: cepSchema,
24
+ residence_situation: textField(),
25
+ address: textField(),
26
+ foundation_date: issueDateSchema,
27
+ months_in_residence: integerField,
28
+ number: textField(),
29
+ cnpj: cnpjSchema,
30
+ email: emailSchema,
31
+ complement: textField(15).optional(),
32
+ phone: phoneBRSchema,
33
+ district: textField(),
34
+ legal_nature: textField(),
35
+ city: textField(),
36
+ economic_activity_group: textField(),
37
+ state: textField(2),
38
+ economic_activity: textField(),
39
+ monthly_income: currencySchema,
40
+ capital_social: currencySchema,
41
+ })
42
+ .strict(),
43
+ financing_company_guarantor: z.array(
44
+ z
45
+ .object({
46
+ name: textField(),
47
+ cep: cepSchema,
48
+ cpf: cpfSchema,
49
+ address: textField(),
50
+ birth_date: birthDateSchema,
51
+ number: textField(),
52
+ complement: textField(15).optional(),
53
+ cellphone: phoneBRSchema,
54
+ phone: phoneBRSchema,
55
+ email: emailSchema,
56
+ district: textField(),
57
+ sex: SexEnum,
58
+ city: textField(),
59
+ state: textField(2),
60
+ civil_status: textField(),
61
+ residence_situation: textField(),
62
+ office: textField(),
63
+ months_in_residence: integerField,
64
+ type_doc: DocumentTypeEnum,
65
+ doc: textField(),
66
+ issuing_body: textField(),
67
+ uf_issuing_body: textField(2),
68
+ doc_issue_date: issueDateSchema,
69
+ doc_expiration_date: dateDMYSchema,
70
+ mother_name: textField(),
71
+ monthly_income: currencySchema,
72
+ patrimony: currencySchema,
73
+ naturalness: textField(),
74
+ uf_naturalness: textField(2),
75
+ nationality: textField(),
76
+ pep_relationship: textField(),
77
+ })
78
+ .strict(),
79
+ ),
80
+ })
81
+
82
+ export const bvPjSchema = bvPjObject.strict().superRefine(applyPjRefinements)
83
+
84
+ export type BvPjFicha = z.infer<typeof bvPjSchema>
@@ -0,0 +1,48 @@
1
+ import { z } from 'zod'
2
+ import { DocumentTypeEnum, SexEnum } from '../../../../shared/enums'
3
+ import { textField } from '../../../../shared/fields/primitives'
4
+ import {
5
+ birthDateSchema,
6
+ cepSchema,
7
+ cpfCnpjSchema,
8
+ cpfSchema,
9
+ currencySchema,
10
+ emailSchema,
11
+ issueDateSchema,
12
+ phoneBRSchema,
13
+ } from '../../../../shared/regex'
14
+ import { formalizationExtras } from '../extras'
15
+ import { applyPfRefinements } from '../refinements'
16
+
17
+ export const caixaEconomicaFederalPfObject = z.object({
18
+ ...formalizationExtras,
19
+ name: textField(),
20
+ cep: cepSchema,
21
+ cpf: cpfSchema,
22
+ address: textField(),
23
+ birth_date: birthDateSchema,
24
+ number: textField(),
25
+ sex: SexEnum,
26
+ complement: textField(15).optional(),
27
+ mother_name: textField(),
28
+ district: textField(),
29
+ energy_account_in_requester_name: textField(),
30
+ city: textField(),
31
+ energy_bill_owner_document: cpfCnpjSchema.optional(),
32
+ state: textField(2),
33
+ nationality: textField(),
34
+ cellphone: phoneBRSchema,
35
+ email: emailSchema,
36
+ monthly_income: currencySchema,
37
+ profession: textField(),
38
+ type_doc: DocumentTypeEnum,
39
+ doc: textField(15),
40
+ issuing_body: textField(6),
41
+ doc_issue_date: issueDateSchema,
42
+ })
43
+
44
+ export const caixaEconomicaFederalPfSchema = caixaEconomicaFederalPfObject
45
+ .strict()
46
+ .superRefine(applyPfRefinements)
47
+
48
+ export type CaixaEconomicaFederalPfFicha = z.infer<typeof caixaEconomicaFederalPfSchema>
@@ -0,0 +1,67 @@
1
+ import { z } from 'zod'
2
+ import { SexEnum } from '../../../../shared/enums'
3
+ import { textField } from '../../../../shared/fields/primitives'
4
+ import {
5
+ birthDateSchema,
6
+ cepSchema,
7
+ cnpjSchema,
8
+ cpfSchema,
9
+ currencySchema,
10
+ emailSchema,
11
+ issueDateSchema,
12
+ phoneBRSchema,
13
+ } from '../../../../shared/regex'
14
+ import { formalizationExtras } from '../extras'
15
+ import { applyPjRefinements } from '../refinements'
16
+
17
+ export const caixaEconomicaFederalPjObject = z.object({
18
+ ...formalizationExtras,
19
+ financing_company: z
20
+ .object({
21
+ corporate_name: textField(),
22
+ cep: cepSchema,
23
+ address: textField(),
24
+ foundation_date: issueDateSchema,
25
+ number: textField(),
26
+ cnpj: cnpjSchema,
27
+ email: emailSchema,
28
+ complement: textField(15).optional(),
29
+ phone: phoneBRSchema,
30
+ district: textField(),
31
+ legal_nature: textField(),
32
+ city: textField(),
33
+ economic_activity_group: textField(),
34
+ state: textField(2),
35
+ economic_activity: textField(),
36
+ monthly_income: currencySchema,
37
+ })
38
+ .strict(),
39
+ financing_company_guarantor: z.array(
40
+ z
41
+ .object({
42
+ name: textField(),
43
+ cep: cepSchema,
44
+ cpf: cpfSchema,
45
+ address: textField(),
46
+ birth_date: birthDateSchema,
47
+ number: textField(),
48
+ complement: textField(15).optional(),
49
+ cellphone: phoneBRSchema,
50
+ email: emailSchema,
51
+ district: textField(),
52
+ sex: SexEnum,
53
+ city: textField(),
54
+ state: textField(2),
55
+ office: textField(),
56
+ mother_name: textField(),
57
+ nationality: textField(),
58
+ })
59
+ .strict(),
60
+ ),
61
+ })
62
+
63
+ export const caixaEconomicaFederalPjSchema = caixaEconomicaFederalPjObject
64
+ .strict()
65
+ .superRefine(applyPjRefinements)
66
+
67
+ export type CaixaEconomicaFederalPjFicha = z.infer<typeof caixaEconomicaFederalPjSchema>
@@ -0,0 +1,46 @@
1
+ import { z } from 'zod'
2
+ import { DocumentTypeEnum, SexEnum } from '../../../../shared/enums'
3
+ import { textField } from '../../../../shared/fields/primitives'
4
+ import {
5
+ birthDateSchema,
6
+ cepSchema,
7
+ cpfCnpjSchema,
8
+ cpfSchema,
9
+ currencySchema,
10
+ emailSchema,
11
+ issueDateSchema,
12
+ phoneBRSchema,
13
+ } from '../../../../shared/regex'
14
+ import { formalizationExtras } from '../extras'
15
+ import { applyPfRefinements } from '../refinements'
16
+
17
+ export const cashMePfObject = z.object({
18
+ ...formalizationExtras,
19
+ name: textField(),
20
+ cep: cepSchema,
21
+ cpf: cpfSchema,
22
+ address: textField(),
23
+ birth_date: birthDateSchema,
24
+ number: textField(),
25
+ sex: SexEnum,
26
+ complement: textField(15).optional(),
27
+ mother_name: textField(),
28
+ district: textField(),
29
+ energy_account_in_requester_name: textField(),
30
+ city: textField(),
31
+ energy_bill_owner_document: cpfCnpjSchema.optional(),
32
+ state: textField(2),
33
+ nationality: textField(),
34
+ cellphone: phoneBRSchema,
35
+ email: emailSchema,
36
+ monthly_income: currencySchema,
37
+ profession: textField(),
38
+ type_doc: DocumentTypeEnum,
39
+ doc: textField(15),
40
+ issuing_body: textField(6),
41
+ doc_issue_date: issueDateSchema,
42
+ })
43
+
44
+ export const cashMePfSchema = cashMePfObject.strict().superRefine(applyPfRefinements)
45
+
46
+ export type CashMePfFicha = z.infer<typeof cashMePfSchema>
@@ -0,0 +1,65 @@
1
+ import { z } from 'zod'
2
+ import { SexEnum } from '../../../../shared/enums'
3
+ import { textField } from '../../../../shared/fields/primitives'
4
+ import {
5
+ birthDateSchema,
6
+ cepSchema,
7
+ cnpjSchema,
8
+ cpfSchema,
9
+ currencySchema,
10
+ emailSchema,
11
+ issueDateSchema,
12
+ phoneBRSchema,
13
+ } from '../../../../shared/regex'
14
+ import { formalizationExtras } from '../extras'
15
+ import { applyPjRefinements } from '../refinements'
16
+
17
+ export const cashMePjObject = z.object({
18
+ ...formalizationExtras,
19
+ financing_company: z
20
+ .object({
21
+ corporate_name: textField(),
22
+ cep: cepSchema,
23
+ address: textField(),
24
+ foundation_date: issueDateSchema,
25
+ number: textField(),
26
+ cnpj: cnpjSchema,
27
+ email: emailSchema,
28
+ complement: textField(15).optional(),
29
+ phone: phoneBRSchema,
30
+ district: textField(),
31
+ legal_nature: textField(),
32
+ city: textField(),
33
+ economic_activity_group: textField(),
34
+ state: textField(2),
35
+ economic_activity: textField(),
36
+ monthly_income: currencySchema,
37
+ })
38
+ .strict(),
39
+ financing_company_guarantor: z.array(
40
+ z
41
+ .object({
42
+ name: textField(),
43
+ cep: cepSchema,
44
+ cpf: cpfSchema,
45
+ address: textField(),
46
+ birth_date: birthDateSchema,
47
+ number: textField(),
48
+ complement: textField(15).optional(),
49
+ cellphone: phoneBRSchema,
50
+ email: emailSchema,
51
+ district: textField(),
52
+ sex: SexEnum,
53
+ city: textField(),
54
+ state: textField(2),
55
+ office: textField(),
56
+ mother_name: textField(),
57
+ nationality: textField(),
58
+ })
59
+ .strict(),
60
+ ),
61
+ })
62
+
63
+ export const cashMePjSchema = cashMePjObject.strict().superRefine(applyPjRefinements)
64
+
65
+ export type CashMePjFicha = z.infer<typeof cashMePjSchema>
@@ -0,0 +1,46 @@
1
+ import { z } from 'zod'
2
+ import { DocumentTypeEnum, SexEnum } from '../../../../shared/enums'
3
+ import { textField } from '../../../../shared/fields/primitives'
4
+ import {
5
+ birthDateSchema,
6
+ cepSchema,
7
+ cpfCnpjSchema,
8
+ cpfSchema,
9
+ currencySchema,
10
+ emailSchema,
11
+ issueDateSchema,
12
+ phoneBRSchema,
13
+ } from '../../../../shared/regex'
14
+ import { formalizationExtras } from '../extras'
15
+ import { applyPfRefinements } from '../refinements'
16
+
17
+ export const credito77PfObject = z.object({
18
+ ...formalizationExtras,
19
+ name: textField(),
20
+ cep: cepSchema,
21
+ cpf: cpfSchema,
22
+ address: textField(),
23
+ birth_date: birthDateSchema,
24
+ number: textField(),
25
+ sex: SexEnum,
26
+ complement: textField(15).optional(),
27
+ mother_name: textField(),
28
+ district: textField(),
29
+ energy_account_in_requester_name: textField(),
30
+ city: textField(),
31
+ energy_bill_owner_document: cpfCnpjSchema.optional(),
32
+ state: textField(2),
33
+ nationality: textField(),
34
+ cellphone: phoneBRSchema,
35
+ email: emailSchema,
36
+ monthly_income: currencySchema,
37
+ profession: textField(),
38
+ type_doc: DocumentTypeEnum,
39
+ doc: textField(15),
40
+ issuing_body: textField(6),
41
+ doc_issue_date: issueDateSchema,
42
+ })
43
+
44
+ export const credito77PfSchema = credito77PfObject.strict().superRefine(applyPfRefinements)
45
+
46
+ export type Credito77PfFicha = z.infer<typeof credito77PfSchema>
@@ -0,0 +1,65 @@
1
+ import { z } from 'zod'
2
+ import { SexEnum } from '../../../../shared/enums'
3
+ import { textField } from '../../../../shared/fields/primitives'
4
+ import {
5
+ birthDateSchema,
6
+ cepSchema,
7
+ cnpjSchema,
8
+ cpfSchema,
9
+ currencySchema,
10
+ emailSchema,
11
+ issueDateSchema,
12
+ phoneBRSchema,
13
+ } from '../../../../shared/regex'
14
+ import { formalizationExtras } from '../extras'
15
+ import { applyPjRefinements } from '../refinements'
16
+
17
+ export const credito77PjObject = z.object({
18
+ ...formalizationExtras,
19
+ financing_company: z
20
+ .object({
21
+ corporate_name: textField(),
22
+ cep: cepSchema,
23
+ address: textField(),
24
+ foundation_date: issueDateSchema,
25
+ number: textField(),
26
+ cnpj: cnpjSchema,
27
+ email: emailSchema,
28
+ complement: textField(15).optional(),
29
+ phone: phoneBRSchema,
30
+ district: textField(),
31
+ legal_nature: textField(),
32
+ city: textField(),
33
+ economic_activity_group: textField(),
34
+ state: textField(2),
35
+ economic_activity: textField(),
36
+ monthly_income: currencySchema,
37
+ })
38
+ .strict(),
39
+ financing_company_guarantor: z.array(
40
+ z
41
+ .object({
42
+ name: textField(),
43
+ cep: cepSchema,
44
+ cpf: cpfSchema,
45
+ address: textField(),
46
+ birth_date: birthDateSchema,
47
+ number: textField(),
48
+ complement: textField(15).optional(),
49
+ cellphone: phoneBRSchema,
50
+ email: emailSchema,
51
+ district: textField(),
52
+ sex: SexEnum,
53
+ city: textField(),
54
+ state: textField(2),
55
+ office: textField(),
56
+ mother_name: textField(),
57
+ nationality: textField(),
58
+ })
59
+ .strict(),
60
+ ),
61
+ })
62
+
63
+ export const credito77PjSchema = credito77PjObject.strict().superRefine(applyPjRefinements)
64
+
65
+ export type Credito77PjFicha = z.infer<typeof credito77PjSchema>