import {z} from 'zod' export type GetApiRoltypenArgs = {zaaktype?: string | undefined, zaaktypeIdentificatie?: string | undefined, omschrijvingGeneriek?: ('adviseur' | 'behandelaar' | 'belanghebbende' | 'beslisser' | 'initiator' | 'klantcontacter' | 'zaakcoordinator' | 'mede_initiator') | undefined, status?: string | undefined, datumGeldigheid?: string | undefined, page?: number | undefined, expand?: string | undefined}; export type GetApiRoltypenOptions = {baseUrl?: string | undefined, JWTClaims?: string | undefined, fetch?: typeof fetch | undefined}; export const omschrijvingGeneriekEnum = z.enum(["adviseur", "behandelaar", "belanghebbende", "beslisser", "initiator", "klantcontacter", "zaakcoordinator", "mede_initiator"]); export const vertrouwelijkheidaanduidingEnum = z.enum(["openbaar", "beperkt_openbaar", "intern", "zaakvertrouwelijk", "vertrouwelijk", "confidentieel", "geheim", "zeer_geheim"]); export const indicatieInternOfExternEnum = z.enum(["intern", "extern"]); export const referentieProces = z.object({naam: z.string().max(80), link: z.string().max(200).optional()}); export const bronCatalogus = z.object({url: z.string().max(200), domein: z.string().max(5), rsin: z.string().max(9)}); export const bronZaaktype = z.object({url: z.string().max(200), identificatie: z.string().max(50), omschrijving: z.string().max(80)}); export const aardRelatieEnum = z.enum(["vervolg", "bijdrage", "onderwerp"]); export const zaakTypenRelatie = z.object({zaaktype: z.string().max(200), aardRelatie: aardRelatieEnum, toelichting: z.string().max(255).optional()}); export const emptyObject = z.object({}); export const archiefnominatieEnum = z.enum(["blijvend_bewaren", "vernietigen"]); export const blankEnum = z.literal(""); export const afleidingswijzeEnum = z.enum(["afgehandeld", "ander_datumkenmerk", "eigenschap", "gerelateerde_zaak", "hoofdzaak", "ingangsdatum_besluit", "termijn", "vervaldatum_besluit", "zaakobject"]); export const objecttypeEnum = z.enum(["adres", "besluit", "buurt", "enkelvoudig_document", "gemeente", "gemeentelijke_openbare_ruimte", "huishouden", "inrichtingselement", "kadastrale_onroerende_zaak", "kunstwerkdeel", "maatschappelijke_activiteit", "medewerker", "natuurlijk_persoon", "niet_natuurlijk_persoon", "openbare_ruimte", "organisatorische_eenheid", "pand", "spoorbaandeel", "status", "terreindeel", "terrein_gebouwd_object", "vestiging", "waterdeel", "wegdeel", "wijk", "woonplaats", "woz_deelobject", "woz_object", "woz_waarde", "zakelijk_recht", "overige"]); export const brondatumArchiefprocedure = z.object({afleidingswijze: afleidingswijzeEnum, datumkenmerk: z.string().max(80).optional(), einddatumBekend: z.boolean().optional(), objecttype: z.union([objecttypeEnum, blankEnum]).optional(), registratie: z.string().max(80).optional(), procestermijn: z.string().nullable().optional()}).nullable(); export const informatieObjectTypeOmschrijvingGeneriek = z.object({informatieobjecttypeOmschrijvingGeneriek: z.string().max(80), definitieInformatieobjecttypeOmschrijvingGeneriek: z.string().max(255), herkomstInformatieobjecttypeOmschrijvingGeneriek: z.string().max(12), hierarchieInformatieobjecttypeOmschrijvingGeneriek: z.string().max(80), opmerkingInformatieobjecttypeOmschrijvingGeneriek: z.string().max(255).nullable().optional()}); export const informatieObjectTypeEmbedded = z.object({catalogus: z.union([z.lazy(() => catalogusExpanded), emptyObject]).optional(), zaaktypen: z.array(z.lazy(() => zaakTypeExpanded)).optional(), besluittypen: z.array(z.lazy(() => besluitTypeExpanded)).optional()}); export const informatieObjectTypeExpanded = z.object({url: z.string().min(1).max(1000), catalogus: z.string(), omschrijving: z.string().max(80), vertrouwelijkheidaanduiding: vertrouwelijkheidaanduidingEnum, beginGeldigheid: z.string(), eindeGeldigheid: z.string().nullable().optional(), beginObject: z.string().nullable().optional(), eindeObject: z.string().nullable().optional(), concept: z.boolean(), zaaktypen: z.array(z.string()), besluittypen: z.array(z.string()), informatieobjectcategorie: z.string().max(80), trefwoord: z.array(z.string().max(30)).optional(), omschrijvingGeneriek: informatieObjectTypeOmschrijvingGeneriek.optional(), _expand: informatieObjectTypeEmbedded.optional()}); export const besluitTypeEmbedded = z.object({catalogus: z.union([z.lazy(() => catalogusExpanded), emptyObject]).optional(), zaaktypen: z.array(z.lazy(() => zaakTypeExpanded)).optional(), informatieobjecttypen: z.array(informatieObjectTypeExpanded).optional(), resultaattypen: z.array(z.lazy(() => resultaatTypeExpanded)).optional()}); export const besluitTypeExpanded: z.ZodType = z.object({url: z.string().min(1).max(1000), catalogus: z.string(), zaaktypen: z.array(z.string()), omschrijving: z.string().max(80).optional(), omschrijvingGeneriek: z.string().max(80).optional(), besluitcategorie: z.string().max(40).optional(), reactietermijn: z.string().nullable().optional(), publicatieIndicatie: z.boolean(), publicatietekst: z.string().optional(), publicatietermijn: z.string().nullable().optional(), toelichting: z.string().optional(), informatieobjecttypen: z.array(z.string()), beginGeldigheid: z.string(), eindeGeldigheid: z.string().nullable().optional(), beginObject: z.string().nullable().optional(), eindeObject: z.string().nullable().optional(), concept: z.boolean(), resultaattypen: z.array(z.string()), resultaattypenOmschrijving: z.array(z.string()), vastgelegdIn: z.array(z.string()), _expand: besluitTypeEmbedded.optional()}); export const resultaatTypeEmbedded = z.object({catalogus: z.union([z.lazy(() => catalogusExpanded), emptyObject]).optional(), zaaktype: z.union([z.lazy(() => zaakTypeExpanded), emptyObject]).optional(), besluittypen: z.array(besluitTypeExpanded).optional(), informatieobjecttypen: z.array(informatieObjectTypeExpanded).optional()}); export const resultaatTypeExpanded: z.ZodType = z.object({url: z.string().min(1).max(1000), zaaktype: z.string(), zaaktypeIdentificatie: z.string(), omschrijving: z.string().max(30), resultaattypeomschrijving: z.string().max(1000), omschrijvingGeneriek: z.string(), selectielijstklasse: z.string().max(1000), toelichting: z.string().optional(), archiefnominatie: z.union([archiefnominatieEnum, blankEnum]).optional(), archiefactietermijn: z.string().nullable().optional(), brondatumArchiefprocedure: brondatumArchiefprocedure.nullable().optional(), procesobjectaard: z.string().max(200).nullable().optional(), catalogus: z.string().nullable().optional(), beginGeldigheid: z.string().nullable().optional(), eindeGeldigheid: z.string().nullable().optional(), beginObject: z.string().nullable().optional(), eindeObject: z.string().nullable().optional(), indicatieSpecifiek: z.boolean().nullable().optional(), procestermijn: z.string().nullable().optional(), besluittypen: z.array(z.string().nullable()).optional(), besluittypeOmschrijving: z.array(z.string()), informatieobjecttypen: z.array(z.string().nullable()).optional(), informatieobjecttypeOmschrijving: z.array(z.string()), _expand: resultaatTypeEmbedded.optional()}); export const checkListItem = z.object({itemnaam: z.string().max(30), toelichting: z.string().max(1000).nullable().optional(), vraagstelling: z.string().max(255), verplicht: z.boolean().optional()}); export const formaatEnum = z.enum(["tekst", "getal", "datum", "datum_tijd"]); export const eigenschapSpecificatie = z.object({groep: z.string().max(32).optional(), formaat: formaatEnum, lengte: z.string().max(14), kardinaliteit: z.string().max(3), waardenverzameling: z.array(z.string().max(100)).optional()}); export const eigenschapEmbedded = z.object({catalogus: z.union([z.lazy(() => catalogusExpanded), emptyObject]).optional(), zaaktype: z.union([z.lazy(() => zaakTypeExpanded), emptyObject]).optional(), statustype: z.union([z.lazy(() => statusTypeExpanded), emptyObject]).optional()}); export const eigenschapExpanded = z.object({url: z.string().min(1).max(1000), naam: z.string().max(20), catalogus: z.string(), definitie: z.string().max(255), specificatie: eigenschapSpecificatie, toelichting: z.string().max(1000).optional(), zaaktype: z.string(), zaaktypeIdentificatie: z.string(), statustype: z.string().nullable().optional(), beginGeldigheid: z.string().nullable().optional(), eindeGeldigheid: z.string().nullable().optional(), beginObject: z.string().nullable().optional(), eindeObject: z.string().nullable().optional(), _expand: eigenschapEmbedded.optional()}); export const statusTypeEmbedded = z.object({catalogus: z.union([z.lazy(() => catalogusExpanded), emptyObject]).optional(), zaaktype: z.union([z.lazy(() => zaakTypeExpanded), emptyObject]).optional(), eigenschappen: z.array(eigenschapExpanded).optional()}); export const statusTypeExpanded: z.ZodType = z.object({url: z.string().min(1).max(1000), omschrijving: z.string().max(80), omschrijvingGeneriek: z.string().max(80).optional(), statustekst: z.string().max(1000).optional(), zaaktype: z.string(), catalogus: z.string(), zaaktypeIdentificatie: z.string(), volgnummer: z.number().int().gte(1).lte(9999), isEindstatus: z.boolean(), informeren: z.boolean().optional(), doorlooptijd: z.string().nullable().optional(), toelichting: z.string().max(1000).nullable().optional(), checklistitemStatustype: z.array(checkListItem).optional(), eigenschappen: z.array(z.string().nullable()).optional(), beginGeldigheid: z.string().nullable().optional(), eindeGeldigheid: z.string().nullable().optional(), beginObject: z.string().nullable().optional(), eindeObject: z.string().nullable().optional(), _expand: statusTypeEmbedded.optional()}); export const zaakObjectTypeEmbedded = z.object({zaaktype: z.union([z.lazy(() => zaakTypeExpanded), emptyObject]).optional(), resultaattypen: z.array(resultaatTypeExpanded).optional(), statustypen: z.array(statusTypeExpanded).optional(), catalogus: z.union([z.lazy(() => catalogusExpanded), emptyObject]).optional()}); export const zaakObjectTypeExpanded = z.object({url: z.string().min(1).max(1000), anderObjecttype: z.boolean(), beginGeldigheid: z.string().optional(), eindeGeldigheid: z.string().nullable().optional(), beginObject: z.string().nullable().optional(), eindeObject: z.string().nullable().optional(), objecttype: z.string().max(200), relatieOmschrijving: z.string().max(80), zaaktype: z.string(), zaaktypeIdentificatie: z.string(), resultaattypen: z.array(z.string()), statustypen: z.array(z.string()), catalogus: z.string(), _expand: zaakObjectTypeEmbedded.optional()}); export const zaakTypeEmbedded = z.object({zaakobjecttypen: z.array(zaakObjectTypeExpanded).optional(), catalogus: z.union([z.lazy(() => catalogusExpanded), emptyObject]).optional(), statustypen: z.array(statusTypeExpanded).optional(), resultaattypen: z.array(resultaatTypeExpanded).optional(), eigenschappen: z.array(eigenschapExpanded).optional(), informatieobjecttypen: z.array(informatieObjectTypeExpanded).optional(), roltypen: z.array(z.lazy(() => rolTypeExpanded)).optional(), besluittypen: z.array(besluitTypeExpanded).optional(), deelzaaktypen: z.array(z.lazy(() => zaakTypeExpanded)).optional(), gerelateerdeZaaktypen: z.array(z.lazy(() => zaakTypeExpanded)).optional()}); export const zaakTypeExpanded: z.ZodType = z.object({url: z.string().min(1).max(1000), identificatie: z.string().max(50), omschrijving: z.string().max(80), omschrijvingGeneriek: z.string().max(80).optional(), vertrouwelijkheidaanduiding: vertrouwelijkheidaanduidingEnum, doel: z.string(), aanleiding: z.string(), toelichting: z.string().optional(), indicatieInternOfExtern: indicatieInternOfExternEnum, handelingInitiator: z.string().max(20), onderwerp: z.string().max(80), handelingBehandelaar: z.string().max(20), doorlooptijd: z.string(), servicenorm: z.string().nullable().optional(), opschortingEnAanhoudingMogelijk: z.boolean(), verlengingMogelijk: z.boolean(), verlengingstermijn: z.string().nullable().optional(), trefwoorden: z.array(z.string().max(30)).optional(), publicatieIndicatie: z.boolean(), publicatietekst: z.string().optional(), verantwoordingsrelatie: z.array(z.string().max(40)).optional(), productenOfDiensten: z.array(z.string().max(1000)), selectielijstProcestype: z.string().max(200).optional(), referentieproces: referentieProces, verantwoordelijke: z.string().max(50), zaakobjecttypen: z.array(z.string()), broncatalogus: bronCatalogus.optional(), bronzaaktype: bronZaaktype.optional(), catalogus: z.string(), statustypen: z.array(z.string()), resultaattypen: z.array(z.string()), eigenschappen: z.array(z.string()), informatieobjecttypen: z.array(z.string()), roltypen: z.array(z.string()), besluittypen: z.array(z.string()), deelzaaktypen: z.array(z.string().nullable()).optional(), gerelateerdeZaaktypen: z.array(zaakTypenRelatie), beginGeldigheid: z.string(), eindeGeldigheid: z.string().nullable().optional(), beginObject: z.string().nullable().optional(), eindeObject: z.string().nullable().optional(), versiedatum: z.string().optional(), concept: z.boolean(), _expand: zaakTypeEmbedded.optional()}); export const catalogusEmbedded = z.object({zaaktypen: z.array(zaakTypeExpanded).optional(), besluittypen: z.array(besluitTypeExpanded).optional(), informatieobjecttypen: z.array(informatieObjectTypeExpanded).optional()}); export const catalogusExpanded: z.ZodType = z.object({url: z.string().min(1).max(1000), domein: z.string().max(5), rsin: z.string().max(9), contactpersoonBeheerNaam: z.string().max(40), contactpersoonBeheerTelefoonnummer: z.string().max(20).optional(), contactpersoonBeheerEmailadres: z.string().max(254).optional(), zaaktypen: z.array(z.string()), besluittypen: z.array(z.string()), informatieobjecttypen: z.array(z.string()), naam: z.string().max(200).nullable().optional(), versie: z.string().max(20).nullable().optional(), begindatumVersie: z.string().nullable().optional(), _expand: catalogusEmbedded.optional()}); export const rolTypeEmbedded = z.object({catalogus: z.union([catalogusExpanded, emptyObject]).optional(), zaaktype: z.union([zaakTypeExpanded, emptyObject]).optional()}); export const rolTypeExpanded: z.ZodType = z.object({url: z.string().min(1).max(1000), zaaktype: z.string(), zaaktypeIdentificatie: z.string(), omschrijving: z.string().max(100), omschrijvingGeneriek: omschrijvingGeneriekEnum, catalogus: z.string().nullable().optional(), beginGeldigheid: z.string().nullable().optional(), eindeGeldigheid: z.string().nullable().optional(), beginObject: z.string().nullable().optional(), eindeObject: z.string().nullable().optional(), _expand: rolTypeEmbedded.optional()}); export const paginatedRolTypeList = z.object({count: z.number().int().optional(), next: z.string().nullable().optional(), previous: z.string().nullable().optional(), results: z.array(rolTypeExpanded).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 }; /** * Alle ROLTYPEn opvragen. * * GET /roltypen */ export const getApiRoltypen = async (args: GetApiRoltypenArgs, options?: GetApiRoltypenOptions) => { const {baseUrl = "https://virtserver.swaggerhub.com/michielverhoef/Catalogussen_API/1.3.0", fetch: fetchFn = fetch, JWTClaims} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.zaaktype != null) query.append("zaaktype", String(args.zaaktype)) if (args.zaaktypeIdentificatie != null) query.append("zaaktypeIdentificatie", String(args.zaaktypeIdentificatie)) if (args.omschrijvingGeneriek != null) query.append("omschrijvingGeneriek", String(args.omschrijvingGeneriek)) if (args.status != null) query.append("status", String(args.status)) if (args.datumGeldigheid != null) query.append("datumGeldigheid", String(args.datumGeldigheid)) if (args.page != null) query.append("page", String(args.page)) if (args.expand != null) query.append("expand", String(args.expand)) if (JWTClaims !== undefined) headers.set('authorization', `Bearer ${JWTClaims}`) const url = `${baseUrl.replace(/\/+$/, '')}/roltypen${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(paginatedRolTypeList, await res.json()) };