All files / src/schemas/ep plenary.ts

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

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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100                        43x                                                         43x                         43x                                                                   43x                      
/**
 * Plenary session and voting record Zod validation schemas.
 *
 * @module schemas/ep/plenary
 */
 
import { z } from 'zod';
import { DateStringSchema } from './common.js';
 
/**
 * Get plenary sessions input schema
 */
export const GetPlenarySessionsSchema = z.object({
  eventId: z.string()
    .min(1)
    .max(200)
    .optional()
    .describe('Meeting event ID for single meeting lookup'),
  dateFrom: DateStringSchema.optional(),
  dateTo: DateStringSchema.optional(),
  location: z.string()
    .min(1)
    .max(100)
    .optional()
    .describe('Session location'),
  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')
});
 
/**
 * Plenary session output schema
 */
export const PlenarySessionSchema = z.object({
  id: z.string(),
  date: z.string(),
  location: z.string(),
  agendaItems: z.array(z.string()),
  votingRecords: z.array(z.string()).optional(),
  attendanceCount: z.number().int().min(0).optional(),
  documents: z.array(z.string()).optional()
});
 
/**
 * Get voting records input schema
 */
export const GetVotingRecordsSchema = z.object({
  sessionId: z.string()
    .min(1)
    .max(100)
    .optional()
    .describe('Plenary session identifier'),
  mepId: z.string()
    .min(1)
    .max(100)
    .optional()
    .describe('MEP identifier'),
  topic: z.string()
    .min(1)
    .max(200)
    .optional()
    .describe('Vote topic or keyword'),
  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')
});
 
/**
 * Voting record output schema
 */
export const VotingRecordSchema = z.object({
  id: z.string(),
  sessionId: z.string(),
  topic: z.string(),
  date: z.string(),
  votesFor: z.number().int().min(0),
  votesAgainst: z.number().int().min(0),
  abstentions: z.number().int().min(0),
  result: z.enum(['ADOPTED', 'REJECTED']),
  mepVotes: z.record(z.string(), z.enum(['FOR', 'AGAINST', 'ABSTAIN'])).optional()
});