import { buildContract } from '@jig-software/trest-core';
import { z } from 'zod';
import { Leave } from '../schemas';

export const leaveContract = buildContract((c) =>
  c
    .prefix('/leaves')
    .parse((p) => p.error.text(400))
    .endpoints({
      getLeaves: (e) =>
        e.method('GET').parse((p) => p.success.object(200, z.array(Leave))),
    }),
);
