import {z} from 'zod' export type CorpusType = 'USC' | 'CFR' | 'STATE' | 'CONSTITUTION' | 'FEDERAL_RULES' | 'FEDERAL_LOCAL_RULES' | 'STATE_CONSTITUTION' | 'STATE_RULES' | 'EXECUTIVE_ACTION' | 'REGULATION' | 'FEDERAL_REGISTER' | 'FEDERAL_REGISTER_NOTICE' | 'AGENCY_GUIDANCE' | 'SENTENCING_GUIDELINES' | 'US_TAX_TREATY' | 'US_TREATY' | 'STATE_AGENCY_GUIDANCE' | 'STATE_AG_OPINION' | 'STATE_REGISTER' | 'SESSION_LAW' | 'STATUTE_COMPILATION' | 'AGENCY_ADJUDICATION' | 'CFR_ANNUAL' | 'USC_ANNUAL' | 'FEDERAL_BILL' | 'FEDERAL_RULES_ANNUAL' | 'FEDERAL_RULES_PROPOSED'; export type StatuteSearchRequest = {query: string, corpusType?: (CorpusType | Array | null) | undefined, state?: ('federal' | 'al' | 'ak' | 'as' | 'az' | 'ar' | 'ca' | 'co' | 'ct' | 'de' | 'dc' | 'fl' | 'ga' | 'gu' | 'hi' | 'id' | 'il' | 'in' | 'ia' | 'ks' | 'ky' | 'la' | 'me' | 'md' | 'ma' | 'mi' | 'mn' | 'ms' | 'mo' | 'mt' | 'ne' | 'nv' | 'nh' | 'nj' | 'nm' | 'ny' | 'nc' | 'nd' | 'mp' | 'oh' | 'ok' | 'or' | 'pa' | 'pr' | 'ri' | 'sc' | 'sd' | 'tn' | 'tx' | 'ut' | 'vt' | 'vi' | 'va' | 'wa' | 'wv' | 'wi' | 'wy' | Array<'federal' | 'al' | 'ak' | 'as' | 'az' | 'ar' | 'ca' | 'co' | 'ct' | 'de' | 'dc' | 'fl' | 'ga' | 'gu' | 'hi' | 'id' | 'il' | 'in' | 'ia' | 'ks' | 'ky' | 'la' | 'me' | 'md' | 'ma' | 'mi' | 'mn' | 'ms' | 'mo' | 'mt' | 'ne' | 'nv' | 'nh' | 'nj' | 'nm' | 'ny' | 'nc' | 'nd' | 'mp' | 'oh' | 'ok' | 'or' | 'pa' | 'pr' | 'ri' | 'sc' | 'sd' | 'tn' | 'tx' | 'ut' | 'vt' | 'vi' | 'va' | 'wa' | 'wv' | 'wi' | 'wy'> | null) | undefined, code?: (string | Array | null) | undefined, article?: (string | Array | null) | undefined, yearFrom?: (number | null) | undefined, yearTo?: (number | null) | undefined, excludeRepealed?: boolean | undefined, actStatus?: ('abolished' | 'deleted' | 'expired' | 'in_force' | 'inactive' | 'non_precedential' | 'not_funded' | 'not_yet_effective' | 'omitted' | 'proposed' | 'recodified' | 'recompiled' | 'rejected' | 'relocated' | 'removed' | 'renumbered' | 'repealed' | 'rescinded' | 'reserved' | 'revoked' | 'superseded' | 'terminated' | 'transferred' | 'unconstitutional' | 'vacant' | 'vacated' | 'vetoed' | 'withdrawn' | Array<'abolished' | 'deleted' | 'expired' | 'in_force' | 'inactive' | 'non_precedential' | 'not_funded' | 'not_yet_effective' | 'omitted' | 'proposed' | 'recodified' | 'recompiled' | 'rejected' | 'relocated' | 'removed' | 'renumbered' | 'repealed' | 'rescinded' | 'reserved' | 'revoked' | 'superseded' | 'terminated' | 'transferred' | 'unconstitutional' | 'vacant' | 'vacated' | 'vetoed' | 'withdrawn'> | null) | undefined, changedSince?: (string | null) | undefined, agency?: (string | Array | null) | undefined, documentType?: ('final' | 'proposed' | 'presidential' | null) | undefined, publishedFrom?: (string | null) | undefined, publishedTo?: (string | null) | undefined, titleNumber?: (number | null) | undefined, chapter?: (string | Array | null) | undefined, part?: (string | Array | null) | undefined, source?: ('administrative_guidance' | 'ag_precedent' | 'agency_guidance' | 'bia_precedent' | 'bis_advisory_opinion' | 'cfpb_circular' | 'cfpb_enforcement_action' | 'cfpb_supervisory_guidance' | 'cftc_staff_letter' | 'cms_iom' | 'copyright_circular' | 'copyright_compendium' | 'cpsc_advisory_opinion' | 'cpsc_secg' | 'ddtc_commodity_jurisdiction' | 'ddtc_guidance' | 'dfars' | 'dfars_pgi' | 'doe_appliance_guidance' | 'doj_business_review' | 'doj_justice_manual' | 'doj_leniency' | 'eeoc_guidance' | 'far' | 'fcc_declaratory_ruling' | 'fdic_fil' | 'ferc_policy_statement' | 'fincen_amla_material' | 'fincen_boi_compliance_guide' | 'fincen_boi_faq' | 'fincen_boi_rule_qa' | 'fincen_guidance' | 'fincen_ruling' | 'frap' | 'frb_sr_letter' | 'frbp' | 'frcp' | 'frcrp' | 'fre' | 'ftc_administrative_decision' | 'ftc_advisory_opinion' | 'ftc_advocacy_filing' | 'ftc_hsr_interpretation' | 'ftc_policy_statement' | 'hhs_ocr_hipaa_faq' | 'hhs_ocr_hipaa_guidance' | 'hhs_ocr_resolution_agreement' | 'immigration_admin_precedent' | 'irs_announcement' | 'irs_irm' | 'irs_notice' | 'irs_rev_proc' | 'irs_rev_rul' | 'irs_written_determination' | 'merger_guidelines' | 'mpep' | 'mspb_nonprecedential' | 'mspb_precedential' | 'nlrb_advice_memo' | 'nlrb_board_decision' | 'nlrb_gc_memo' | 'occ_bulletin' | 'occ_interpretive_letter' | 'ofac_faq' | 'olc_opinion' | 'sct' | 'sec_commission_opinion' | 'senate_executive_report' | 'senate_treaty' | 'senate_treaty_document' | 'senate_treaty_resolution' | 'ssa_ruling' | 'state_financial_bulletin' | 'state_insurance_bulletin' | 'tmep' | 'us_tax_treaty' | 'us_tax_treaty_technical_explanation' | 'us_treaty' | 'uscis_policy_manual' | 'whd_foh' | 'whd_opinion_letter' | Array<'administrative_guidance' | 'ag_precedent' | 'agency_guidance' | 'bia_precedent' | 'bis_advisory_opinion' | 'cfpb_circular' | 'cfpb_enforcement_action' | 'cfpb_supervisory_guidance' | 'cftc_staff_letter' | 'cms_iom' | 'copyright_circular' | 'copyright_compendium' | 'cpsc_advisory_opinion' | 'cpsc_secg' | 'ddtc_commodity_jurisdiction' | 'ddtc_guidance' | 'dfars' | 'dfars_pgi' | 'doe_appliance_guidance' | 'doj_business_review' | 'doj_justice_manual' | 'doj_leniency' | 'eeoc_guidance' | 'far' | 'fcc_declaratory_ruling' | 'fdic_fil' | 'ferc_policy_statement' | 'fincen_amla_material' | 'fincen_boi_compliance_guide' | 'fincen_boi_faq' | 'fincen_boi_rule_qa' | 'fincen_guidance' | 'fincen_ruling' | 'frap' | 'frb_sr_letter' | 'frbp' | 'frcp' | 'frcrp' | 'fre' | 'ftc_administrative_decision' | 'ftc_advisory_opinion' | 'ftc_advocacy_filing' | 'ftc_hsr_interpretation' | 'ftc_policy_statement' | 'hhs_ocr_hipaa_faq' | 'hhs_ocr_hipaa_guidance' | 'hhs_ocr_resolution_agreement' | 'immigration_admin_precedent' | 'irs_announcement' | 'irs_irm' | 'irs_notice' | 'irs_rev_proc' | 'irs_rev_rul' | 'irs_written_determination' | 'merger_guidelines' | 'mpep' | 'mspb_nonprecedential' | 'mspb_precedential' | 'nlrb_advice_memo' | 'nlrb_board_decision' | 'nlrb_gc_memo' | 'occ_bulletin' | 'occ_interpretive_letter' | 'ofac_faq' | 'olc_opinion' | 'sct' | 'sec_commission_opinion' | 'senate_executive_report' | 'senate_treaty' | 'senate_treaty_document' | 'senate_treaty_resolution' | 'ssa_ruling' | 'state_financial_bulletin' | 'state_insurance_bulletin' | 'tmep' | 'us_tax_treaty' | 'us_tax_treaty_technical_explanation' | 'us_treaty' | 'uscis_policy_manual' | 'whd_foh' | 'whd_opinion_letter'> | null) | undefined, fields?: (Array<'abstract' | 'actId' | 'actStatus' | 'action' | 'adoptedAfterCurrentThrough' | 'adoptingCitations' | 'agencies' | 'agencySlugs' | 'alternateCitations' | 'amendmentHistory' | 'amendmentHistoryNote' | 'amendmentNote' | 'amendmentYears' | 'amendmentsCount' | 'articleName' | 'articleNumber' | 'audience' | 'body' | 'bodyNote' | 'bodyServedNote' | 'bodyUnavailable' | 'bodyUnavailableReason' | 'breadcrumb' | 'caseName' | 'chapter' | 'chapterName' | 'citation' | 'citationNote' | 'citationShort' | 'committeeNote' | 'corpusType' | 'court' | 'crossReferencesCfr' | 'crossReferencesCfrChecked' | 'crossReferencesUsc' | 'currencyNote' | 'currencyYear' | 'currentThrough' | 'datesText' | 'displayLabel' | 'displayPath' | 'documentNumber' | 'documentSubtype' | 'documentTypeLabel' | 'docxUrl' | 'edition' | 'effectiveDate' | 'effectiveDateRaw' | 'excerpt' | 'executiveOrderNumber' | 'expirationDate' | 'expirationDateRaw' | 'externalUrl' | 'federalRegisterCitations' | 'fieldAbsenceNote' | 'forum' | 'frCommentsCloseOn' | 'frCorrectionOf' | 'frCorrections' | 'frDocketIds' | 'frEffectiveOn' | 'frEndPage' | 'frRegulationIdNumbers' | 'frRegulationsDotGovUrl' | 'frRelatedDocuments' | 'frRelatedDocumentsNote' | 'frSignificant' | 'frStartPage' | 'frVolume' | 'goodLawBasis' | 'goodLawStatus' | 'govInfoHtmlUrl' | 'govInfoPdfUrl' | 'granuleId' | 'history' | 'historyEffectiveDate' | 'htmlUrl' | 'implementingRegulations' | 'instrumentNumberSource' | 'issueDate' | 'issueDateRaw' | 'issuingAgency' | 'languageCode' | 'lastAmendedDate' | 'lastAmendedDateRaw' | 'lastAmendedYear' | 'lawImplemented' | 'matchContexts' | 'matchNoteYear' | 'matchSegment' | 'originalEnactmentDate' | 'originalEnactmentDateRaw' | 'packageId' | 'parent' | 'part' | 'partName' | 'pdfUrl' | 'pendingAdoptions' | 'pendingAmendments' | 'popularName' | 'president' | 'priorEffectiveDates' | 'priorEffectiveDatesRaw' | 'proclamationNumber' | 'program' | 'publicLawCites' | 'publicLaws' | 'publicationDate' | 'publicationDateRaw' | 'publisherKey' | 'referencedShortTitles' | 'relatedCitations' | 'relatedDocuments' | 'releaseDate' | 'releaseDateRaw' | 'relevanceScore' | 'renumberedTo' | 'renumberedToLabel' | 'requesters' | 'rescindedOn' | 'rescindedOnRaw' | 'responseBounds' | 'reviewDate' | 'reviewDateRaw' | 'ruleSet' | 'ruleSetCode' | 'sectionNumber' | 'sectionTitle' | 'settlementAmount' | 'signingDate' | 'signingDateRaw' | 'source' | 'sourceCharEnd' | 'sourceCharStart' | 'sourceCredit' | 'sourceNote' | 'sourcePageEnd' | 'sourcePageStart' | 'sourceUrl' | 'sourceUrlNote' | 'state' | 'stateHtmlUrl' | 'statutoryAuthority' | 'subchapter' | 'subchapterName' | 'subject' | 'subjectNumber' | 'subpart' | 'subpartName' | 'subtitle' | 'subtitleName' | 'supersededBy' | 'supersedes' | 'supersessionActions' | 'textUrl' | 'title' | 'titleName' | 'titleNumber' | 'topLevelTitle' | 'topics' | 'transferredTo' | 'transferredToLabel' | 'versionId' | 'volume' | 'wordCount' | 'xmlUrl' | 'year'> | Array<'abstract' | 'actId' | 'actStatus' | 'action' | 'adoptedAfterCurrentThrough' | 'adoptingCitations' | 'agencies' | 'agencySlugs' | 'alternateCitations' | 'amendmentHistory' | 'amendmentHistoryNote' | 'amendmentNote' | 'amendmentYears' | 'amendmentsCount' | 'articleName' | 'articleNumber' | 'audience' | 'body' | 'bodyNote' | 'bodyServedNote' | 'bodyUnavailable' | 'bodyUnavailableReason' | 'breadcrumb' | 'caseName' | 'chapter' | 'chapterName' | 'citation' | 'citationNote' | 'citationShort' | 'committeeNote' | 'corpusType' | 'court' | 'crossReferencesCfr' | 'crossReferencesCfrChecked' | 'crossReferencesUsc' | 'currencyNote' | 'currencyYear' | 'currentThrough' | 'datesText' | 'displayLabel' | 'displayPath' | 'documentNumber' | 'documentSubtype' | 'documentTypeLabel' | 'docxUrl' | 'edition' | 'effectiveDate' | 'effectiveDateRaw' | 'excerpt' | 'executiveOrderNumber' | 'expirationDate' | 'expirationDateRaw' | 'externalUrl' | 'federalRegisterCitations' | 'fieldAbsenceNote' | 'forum' | 'frCommentsCloseOn' | 'frCorrectionOf' | 'frCorrections' | 'frDocketIds' | 'frEffectiveOn' | 'frEndPage' | 'frRegulationIdNumbers' | 'frRegulationsDotGovUrl' | 'frRelatedDocuments' | 'frRelatedDocumentsNote' | 'frSignificant' | 'frStartPage' | 'frVolume' | 'goodLawBasis' | 'goodLawStatus' | 'govInfoHtmlUrl' | 'govInfoPdfUrl' | 'granuleId' | 'history' | 'historyEffectiveDate' | 'htmlUrl' | 'implementingRegulations' | 'instrumentNumberSource' | 'issueDate' | 'issueDateRaw' | 'issuingAgency' | 'languageCode' | 'lastAmendedDate' | 'lastAmendedDateRaw' | 'lastAmendedYear' | 'lawImplemented' | 'matchContexts' | 'matchNoteYear' | 'matchSegment' | 'originalEnactmentDate' | 'originalEnactmentDateRaw' | 'packageId' | 'parent' | 'part' | 'partName' | 'pdfUrl' | 'pendingAdoptions' | 'pendingAmendments' | 'popularName' | 'president' | 'priorEffectiveDates' | 'priorEffectiveDatesRaw' | 'proclamationNumber' | 'program' | 'publicLawCites' | 'publicLaws' | 'publicationDate' | 'publicationDateRaw' | 'publisherKey' | 'referencedShortTitles' | 'relatedCitations' | 'relatedDocuments' | 'releaseDate' | 'releaseDateRaw' | 'relevanceScore' | 'renumberedTo' | 'renumberedToLabel' | 'requesters' | 'rescindedOn' | 'rescindedOnRaw' | 'responseBounds' | 'reviewDate' | 'reviewDateRaw' | 'ruleSet' | 'ruleSetCode' | 'sectionNumber' | 'sectionTitle' | 'settlementAmount' | 'signingDate' | 'signingDateRaw' | 'source' | 'sourceCharEnd' | 'sourceCharStart' | 'sourceCredit' | 'sourceNote' | 'sourcePageEnd' | 'sourcePageStart' | 'sourceUrl' | 'sourceUrlNote' | 'state' | 'stateHtmlUrl' | 'statutoryAuthority' | 'subchapter' | 'subchapterName' | 'subject' | 'subjectNumber' | 'subpart' | 'subpartName' | 'subtitle' | 'subtitleName' | 'supersededBy' | 'supersedes' | 'supersessionActions' | 'textUrl' | 'title' | 'titleName' | 'titleNumber' | 'topLevelTitle' | 'topics' | 'transferredTo' | 'transferredToLabel' | 'versionId' | 'volume' | 'wordCount' | 'xmlUrl' | 'year'> | null) | undefined, matchType?: ('any' | 'all' | 'phrase' | 'boolean') | undefined, limit?: number | undefined, offset?: number | undefined, includeBody?: boolean | undefined, includePinpoint?: boolean | undefined, excerptChars?: number | undefined}; export type CreateApiApiV1UsStatutesSearchArgs = {'Idempotency-Key'?: (string | null) | undefined, body: StatuteSearchRequest}; export type CreateApiApiV1UsStatutesSearchOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; export const booleanMatchContext = z.object({text: z.string(), highlights: z.array(z.array(z.number().int()))}); export const cfrReferenceCheck = z.object({reference: z.string(), title: z.number().int().nullable().optional(), section: z.string().nullable().optional(), status: z.enum(["held", "not_held", "malformed"]), actId: z.string().nullable().optional(), titleAssumed: z.boolean().optional()}); export const frRelatedDocument = z.object({actId: z.string(), citation: z.string().nullable().optional(), title: z.string().nullable().optional(), documentType: z.string().nullable().optional(), publicationDate: z.string().nullable().optional()}); export const boundedField = z.object({field: z.string(), unit: z.enum(["items", "characters"]), total: z.number().int(), returned: z.number().int(), nextOffset: z.number().int()}); export const responseBounds = z.object({truncated: z.boolean(), fields: z.array(boundedField).optional(), note: z.string().nullable().optional()}); export const pendingAmendment = z.object({id: z.string(), status: z.string().nullable().optional(), cycle: z.number().int().nullable().optional(), effectiveDate: z.string().nullable().optional(), commentPeriodEnd: z.string().nullable().optional(), sourceUrl: z.string().nullable().optional(), textComplete: z.boolean().nullable().optional(), commentDocketIds: z.array(z.string()).optional()}); export const statuteResult = z.object({actId: z.string(), citation: z.string().nullable(), citationShort: z.string().nullable(), title: z.string().nullable(), corpusType: z.string().nullable(), state: z.string().nullable(), source: z.string().nullable(), year: z.number().int().nullable(), relevanceScore: z.number().nullable(), excerpt: z.string(), body: z.string().nullable(), bodyUnavailable: z.boolean().nullable().optional(), bodyUnavailableReason: z.enum(["image_only_source", "misfiled_source_text", "partial_snapshot_text"]).nullable().optional(), bodyNote: z.enum(["fetch_failed", "no_text", "insufficient_credits", "response_size_cap"]).nullable().optional(), bodyServedNote: z.string().nullable().optional(), matchContexts: z.array(booleanMatchContext).nullable().optional(), titleNumber: z.string().nullable(), titleName: z.string().nullable(), chapter: z.string().nullable(), chapterName: z.string().nullable(), sectionNumber: z.string().nullable(), sectionTitle: z.string().nullable(), displayPath: z.string().nullable(), breadcrumb: z.array(z.record(z.string(), z.string())).nullable(), parent: z.record(z.string(), z.unknown()).nullable(), subchapter: z.string().nullable(), subchapterName: z.string().nullable(), part: z.string().nullable(), partName: z.string().nullable(), subpart: z.string().nullable(), subpartName: z.string().nullable(), popularName: z.string().nullable(), actStatus: z.string().nullable(), goodLawStatus: z.string().nullable(), goodLawBasis: z.string().nullable(), currencyNote: z.string().nullable(), renumberedTo: z.string().nullable().optional(), renumberedToLabel: z.string().nullable().optional(), transferredTo: z.string().nullable().optional(), transferredToLabel: z.string().nullable().optional(), issueDate: z.string().nullable(), issueDateRaw: z.string().nullable().optional(), crossReferencesCfr: z.array(z.string()).nullable().optional(), crossReferencesCfrChecked: z.array(cfrReferenceCheck).nullable().optional(), crossReferencesUsc: z.array(z.string()).nullable().optional(), statutoryAuthority: z.array(z.record(z.string(), z.unknown())).nullable().optional(), implementingRegulations: z.array(z.record(z.string(), z.unknown())).nullable().optional(), frRegulationIdNumbers: z.array(z.string()).nullable().optional(), frDocketIds: z.array(z.string()).nullable().optional(), frEffectiveOn: z.string().nullable().optional(), frCommentsCloseOn: z.string().nullable().optional(), frSignificant: z.boolean().nullable().optional(), frCorrectionOf: z.string().nullable().optional(), frCorrections: z.array(z.string()).nullable().optional(), frRegulationsDotGovUrl: z.string().nullable().optional(), frRelatedDocuments: z.array(frRelatedDocument).nullable().optional(), frRelatedDocumentsNote: z.string().nullable().optional(), subject: z.string().nullable().optional(), rescindedOn: z.string().nullable().optional(), rescindedOnRaw: z.string().nullable().optional(), sourceCredit: z.string().nullable().optional(), amendmentYears: z.array(z.number().int()).nullable(), lastAmendedYear: z.number().int().nullable(), amendmentsCount: z.number().int().nullable(), currentThrough: z.string().nullable(), pendingAdoptions: z.array(z.record(z.string(), z.unknown())).nullable().optional(), adoptedAfterCurrentThrough: z.boolean().nullable().optional(), amendmentHistory: z.array(z.string()).nullable().optional(), amendmentHistoryNote: z.string().nullable().optional(), fieldAbsenceNote: z.string().nullable().optional(), citationNote: z.string().nullable().optional(), responseBounds: responseBounds.nullable().optional(), sourceNote: z.string().nullable().optional(), effectiveDate: z.string().nullable(), effectiveDateRaw: z.string().nullable().optional(), historyEffectiveDate: z.string().nullable(), priorEffectiveDates: z.array(z.string()).nullable().optional(), priorEffectiveDatesRaw: z.array(z.string()).nullable().optional(), history: z.string().nullable(), supersededBy: z.string().nullable().optional(), supersedes: z.string().nullable().optional(), pendingAmendments: z.array(pendingAmendment).nullable().optional(), ruleSet: z.string().nullable().optional(), publicLaws: z.array(z.string()).nullable().optional(), federalRegisterCitations: z.array(z.string()).nullable().optional(), granuleId: z.string().nullable().optional(), packageId: z.string().nullable().optional(), htmlUrl: z.string().nullable(), pdfUrl: z.string().nullable(), xmlUrl: z.string().nullable(), textUrl: z.string().nullable(), docxUrl: z.string().nullable().optional(), stateHtmlUrl: z.string().nullable(), govInfoHtmlUrl: z.string().nullable().optional(), govInfoPdfUrl: z.string().nullable().optional(), abstract: z.string().nullable().optional(), agencies: z.array(z.string()).nullable().optional(), agencySlugs: z.array(z.string()).nullable().optional(), topics: z.array(z.string()).nullable().optional(), documentTypeLabel: z.string().nullable().optional(), documentSubtype: z.string().nullable().optional(), action: z.string().nullable().optional(), president: z.string().nullable().optional(), signingDate: z.string().nullable().optional(), signingDateRaw: z.string().nullable().optional(), executiveOrderNumber: z.string().nullable().optional(), proclamationNumber: z.string().nullable().optional(), instrumentNumberSource: z.string().nullable().optional(), datesText: z.string().nullable().optional(), frVolume: z.number().int().nullable().optional(), frStartPage: z.number().int().nullable().optional(), frEndPage: z.number().int().nullable().optional(), wordCount: z.number().int().nullable().optional(), issuingAgency: z.string().nullable().optional(), adoptingCitations: z.array(z.string()).nullable().optional(), lawImplemented: z.string().nullable().optional(), lastAmendedDate: z.string().nullable().optional(), lastAmendedDateRaw: z.string().nullable().optional(), amendmentNote: z.string().nullable().optional(), currencyYear: z.number().int().nullable().optional(), reviewDate: z.string().nullable().optional(), reviewDateRaw: z.string().nullable().optional(), originalEnactmentDate: z.string().nullable().optional(), originalEnactmentDateRaw: z.string().nullable().optional(), releaseDate: z.string().nullable().optional(), releaseDateRaw: z.string().nullable().optional(), documentNumber: z.string().nullable().optional(), caseName: z.string().nullable().optional(), forum: z.string().nullable().optional(), court: z.string().nullable().optional(), relatedDocuments: z.array(z.string()).nullable().optional(), settlementAmount: z.string().nullable().optional(), requesters: z.array(z.string()).nullable().optional(), program: z.string().nullable().optional(), languageCode: z.string().nullable().optional(), volume: z.number().int().nullable().optional(), articleNumber: z.string().nullable().optional(), articleName: z.string().nullable().optional(), ruleSetCode: z.string().nullable().optional(), edition: z.string().nullable().optional(), relatedCitations: z.array(z.string()).nullable().optional(), supersessionActions: z.record(z.string(), z.unknown()).nullable().optional(), subtitle: z.string().nullable().optional(), subtitleName: z.string().nullable().optional(), publisherKey: z.string().nullable().optional(), versionId: z.string().nullable().optional(), referencedShortTitles: z.array(z.string()).nullable().optional(), subjectNumber: z.string().nullable().optional(), audience: z.string().nullable().optional(), sourceCharStart: z.number().int().nullable().optional(), sourceCharEnd: z.number().int().nullable().optional(), matchSegment: z.enum(["rule_text", "source_credit", "note"]).nullable(), matchNoteYear: z.number().int().nullable(), alternateCitations: z.array(z.string()).nullable().optional(), expirationDate: z.string().nullable().optional(), expirationDateRaw: z.string().nullable().optional(), committeeNote: z.string().nullable().optional(), sourcePageStart: z.number().int().nullable().optional(), sourcePageEnd: z.number().int().nullable().optional(), displayLabel: z.string().nullable().optional(), publicationDate: z.string().nullable().optional(), publicationDateRaw: z.string().nullable().optional(), publicLawCites: z.array(z.record(z.string(), z.unknown())).nullable().optional(), topLevelTitle: z.string().nullable().optional(), externalUrl: z.string().nullable(), sourceUrl: z.string().nullable(), sourceUrlNote: z.string().nullable()}); export const citationOutsideFilters = z.object({actId: z.string(), citation: z.string().nullable().optional(), title: z.string().nullable().optional(), state: z.string().nullable().optional(), corpusType: z.string().nullable().optional(), excludedBy: z.array(z.string()).optional()}); export const missReasonCandidate = z.object({state: z.string(), actId: z.string(), citation: z.string().nullable().optional(), subsection: z.string().nullable().optional()}); export const citationMissReason = z.object({missReason: z.enum(["not_held", "former_law", "ambiguous_jurisdiction", "malformed", "out_of_scope_corpus", "container_not_supported", "index_warming", "lookup_failed", "miss_reason_unavailable"]), missReasonHint: z.string().nullable().optional(), candidates: z.array(missReasonCandidate).nullable().optional()}); export const pinpointLeadIn = z.object({path: z.array(z.string()), label: z.string(), text: z.string()}); export const pinpointStructure = z.object({source: z.enum(["artifact", "request_time"]), quality: z.string().nullable().optional(), builder: z.string().nullable().optional(), textSha256: z.string().nullable().optional()}); export const searchHitPinpoint = z.object({located: z.boolean(), path: z.array(z.string()).optional(), label: z.string().nullable().optional(), level: z.string().nullable().optional(), pinpoint: z.string().nullable().optional(), citation: z.string().nullable().optional(), text: z.string().nullable().optional(), leadIn: z.array(pinpointLeadIn).optional(), charStart: z.number().int().nullable().optional(), charEnd: z.number().int().nullable().optional(), matchedBy: z.enum(["passage", "query"]).nullable().optional(), scope: z.enum(["unit", "parent"]).nullable().optional(), matchedTerms: z.array(z.string()).optional(), structure: pinpointStructure.nullable().optional(), reason: z.enum(["no_structure", "no_single_unit", "text_unavailable", "section_too_long", "lookup_failed", "not_looked_up"]).nullable().optional(), note: z.string().nullable().optional()}); export const statuteSearchResponse = z.object({results: z.array(statuteResult).optional(), count: z.number().int().optional(), total: z.number().int().optional(), offset: z.number().int().optional(), hasMore: z.boolean().optional(), changedSectionCount: z.number().int().nullable().optional(), rankingDegraded: z.boolean().optional(), noGoodMatch: z.boolean().nullable().optional(), matchQuality: z.enum(["exact", "strong", "moderate", "weak", "none"]).nullable().optional(), citationOutsideFilters: citationOutsideFilters.nullable().optional(), citationMissReason: citationMissReason.nullable().optional(), parsedQuery: z.string().nullable().optional(), queryWarnings: z.array(z.string()).nullable().optional(), totalMatches: z.number().int().nullable().optional(), totalMatchesExact: z.boolean().nullable().optional(), relevanceRankedCount: z.number().int().nullable().optional(), nextOffset: z.number().int().nullable().optional(), queryHint: z.string().nullable().optional(), pinpoints: z.record(z.string(), searchHitPinpoint).nullable().optional(), pinpointNote: z.string().nullable().optional(), droppedCount: z.number().int().nullable().optional(), bodyNote: z.string().nullable().optional(), rankingPartial: z.boolean().optional(), notes: z.array(z.string()).nullable().optional(), query: z.string().optional(), processingTimeMs: z.number().optional(), creditsConsumed: z.number().optional()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Search US statutes, constitutions, court rules, and executive actions * * POST /api/v1/us/statutes/search * * Also accepts auth: ApiKeyHeader */ export const createApiApiV1UsStatutesSearch = async (args: CreateApiApiV1UsStatutesSearchArgs, options?: CreateApiApiV1UsStatutesSearchOptions) => { const {baseUrl = "https://api.vaquill.ai", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args['Idempotency-Key'] != null) headers.set("Idempotency-Key", String(args['Idempotency-Key'])) if (ApiKeyAuth !== undefined) headers.set('authorization', `Bearer ${ApiKeyAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/us/statutes/search${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(statuteSearchResponse, await res.json()) };