# All files / src/schemas/ep question.ts

100% Statements 2/2
100% Branches 0/0
100% Functions 0/0
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67

    58x

    58x

     /**
     * Parliamentary question Zod validation schemas.
     *
     * @module schemas/ep/question
     */

    import { z } from 'zod';
    import { DateStringSchema, refineDateRange, DATE_RANGE_ERROR } from './common.js';

    /**
     * Get parliamentary questions input schema
     */
    export const GetParliamentaryQuestionsSchema = z.object({
      docId: z.string()
        .min(1)
        .max(200)
        .optional()
        .describe('Document ID for single question lookup'),
      type: z.enum(['WRITTEN', 'ORAL'])
        .optional()
        .describe('Question type'),
      author: z.string()
        .min(1)
        .max(100)
        .optional()
        .describe('MEP identifier or name'),
      topic: z.string()
        .min(1)
        .max(200)
        .optional()
        .describe('Question topic or keyword'),
      status: z.enum(['PENDING', 'ANSWERED'])
        .optional()
        .describe('Question status'),
      dateFrom: DateStringSchema.optional(),
      dateTo: DateStringSchema.optional(),
      limit: z.number()
        .int()
        .min(1)
        .max(100)
        .default(50)
        .describe('Maximum results to return'),
      offset: z.number()
        .int()
        .min(0)
        .default(0)
        .describe('Pagination offset')
    }).refine(
      refineDateRange,
      { message: DATE_RANGE_ERROR }
    );

    /**
     * Parliamentary question output schema
     */
    export const ParliamentaryQuestionSchema = z.object({
      id: z.string(),
      type: z.enum(['WRITTEN', 'ORAL']),
      author: z.string(),
      date: z.string(),
      topic: z.string(),
      questionText: z.string(),
      answerText: z.string().optional(),
      answerDate: z.string().optional(),
      status: z.enum(['PENDING', 'ANSWERED'])
    });