Open History to see the last commit
1import { z } from 'zod'
2import { fallback } from '@tanstack/zod-adapter'
3import type { SettlementCurrency } from './types'
4
5export const SETTLEMENT_CURRENCIES = [
6 'DKK',
7 'EUR',
8 'GBP',
9 'NOK',
10 'PLN',
11 'SEK',
12 'USD',
13] as const
14
15export const SETTLEMENT_CURRENCY_MAP: Record<SettlementCurrency, string> = {
16 DKK: 'DKK',
17 EUR: 'EUR',
18 GBP: 'GBP',
19 NOK: 'NOK',
20 PLN: 'PLN',
21 SEK: 'SEK',
22 USD: 'USD',
23}
24
25export const settlementSchema = z.object({
26 id: z.string(),
27 currency: z.enum(SETTLEMENT_CURRENCIES),
28 from: z.iso.datetime(),
29 to: z.iso.datetime(),
30})
31
32export const settlementsSearchSchema = z.object({
33 currency: fallback(z.enum(SETTLEMENT_CURRENCIES).optional(), undefined),
34 from: fallback(z.string().optional(), undefined),
35 to: fallback(z.string().optional(), undefined),
36})