UNPKG

@accounter/shaam6111-generator

Version:

Fully typed application that generates, parses, and validates SHAAM 6111 tax reports.

88 lines (87 loc) 4.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.headerSchema = void 0; const zod_1 = require("zod"); const report_data_js_1 = require("../types/report-data.js"); /** * Zod schema for HeaderRecord * Enforces strict validation based on the specification. */ exports.headerSchema = zod_1.z.object({ taxFileNumber: zod_1.z .string() .length(9, { message: 'Tax file number must be exactly 9 digits' }) .regex(/^[0-9]+$/, { message: 'Tax file number must contain only digits' }), taxYear: zod_1.z .string() .length(4, { message: 'Tax year must be exactly 4 digits' }) .regex(/^[0-9]{4}$/, { message: 'Tax year must contain only digits' }), idNumber: zod_1.z .string() .length(9, { message: 'ID number must be exactly 9 digits' }) .regex(/^[0-9]+$/, { message: 'ID number must contain only digits' }), vatFileNumber: zod_1.z .string() .length(9, { message: 'VAT file number must be exactly 9 digits' }) .regex(/^[0-9]+$/, { message: 'VAT file number must contain only digits' }) .optional(), withholdingTaxFileNumber: zod_1.z .string() .length(9, { message: 'Withholding tax file number must be exactly 9 digits' }) .regex(/^[0-9]+$/, { message: 'Withholding tax file number must contain only digits' }) .optional(), industryCode: zod_1.z .string() .length(4, { message: 'Industry code must be exactly 4 digits' }) .regex(/^[0-9]+$/, { message: 'Industry code must contain only digits' }), businessDescription: zod_1.z .string() .max(50, { message: 'Business description cannot exceed 50 characters' }) .optional(), businessType: zod_1.z.nativeEnum(report_data_js_1.BusinessType), reportingMethod: zod_1.z.nativeEnum(report_data_js_1.ReportingMethod), accountingMethod: zod_1.z.nativeEnum(report_data_js_1.AccountingMethod), accountingSystem: zod_1.z.nativeEnum(report_data_js_1.AccountingSystem), isPartnership: zod_1.z.nativeEnum(report_data_js_1.YesNo).optional(), includesProfitLoss: zod_1.z.nativeEnum(report_data_js_1.YesNo), includesTaxAdjustment: zod_1.z.nativeEnum(report_data_js_1.YesNo), includesBalanceSheet: zod_1.z.nativeEnum(report_data_js_1.YesNo), profitLossEntryCount: zod_1.z .number() .int({ message: 'Profit and loss entry count must be an integer' }) .min(0, { message: 'Profit and loss entry count cannot be negative' }) .optional(), taxAdjustmentEntryCount: zod_1.z .number() .int({ message: 'Tax adjustment entry count must be an integer' }) .min(0, { message: 'Tax adjustment entry count cannot be negative' }) .optional(), balanceSheetEntryCount: zod_1.z .number() .int({ message: 'Balance sheet entry count must be an integer' }) .min(0, { message: 'Balance sheet entry count cannot be negative' }) .optional(), ifrsImplementationYear: zod_1.z .string() .length(4, { message: 'IFRS implementation year must be exactly 4 digits' }) .regex(/^(200[6-9]|20[1-9][0-9]|9999)$/, { message: 'Invalid IFRS implementation year' }) .optional(), ifrsReportingOption: zod_1.z.nativeEnum(report_data_js_1.IfrsReportingOption).optional(), softwareRegistrationNumber: zod_1.z .string() .length(8, { message: 'Software registration number must be exactly 8 digits' }) .regex(/^[0-9]+$/, { message: 'Software registration number must contain only digits' }) .optional(), partnershipCount: zod_1.z .number() .int({ message: 'Partnership count must be an integer' }) .min(0, { message: 'Partnership count cannot be negative' }) .optional(), partnershipProfitShare: zod_1.z .number() .min(0, { message: 'Partnership profit share cannot be negative' }) .optional(), currencyType: zod_1.z.nativeEnum(report_data_js_1.CurrencyType), auditOpinionType: zod_1.z.nativeEnum(report_data_js_1.AuditOpinionType).optional(), amountsInThousands: zod_1.z.nativeEnum(report_data_js_1.YesNo), });