/**
* Zod schemas for Password endpoints
*/
import { z } from 'zod';
import { PaginationSchema, ResponseFormatSchema, SortDirectionSchema, IdSchema, NameFilterSchema, OrganizationIdFilterSchema } from './common.js';
/**
* List passwords input schema
*/
export const ListPasswordsSchema = z.object({
...PaginationSchema.shape,
response_format: ResponseFormatSchema,
organization_id: OrganizationIdFilterSchema,
name: NameFilterSchema,
password_category_id: z.number().int().positive().optional()
.describe('Filter by password category ID'),
url: z.string().optional()
.describe('Filter by URL (partial match)'),
archived: z.boolean().optional()
.describe('Filter by archived status'),
sort: z.enum(['name', 'id', 'updated_at', 'created_at'])
.default('name')
.describe('Field to sort by'),
sort_direction: SortDirectionSchema,
show_password: z.boolean().default(false)
.describe('Include actual password values in response (requires password access permission)')
}).strict();
export type ListPasswordsInput = z.infer<typeof ListPasswordsSchema>;
/**
* Get password by ID schema
*/
export const GetPasswordSchema = z.object({
id: IdSchema,
response_format: ResponseFormatSchema,
show_password: z.boolean().default(true)
.describe('Include actual password value in response (requires password access permission)')
}).strict();
export type GetPasswordInput = z.infer<typeof GetPasswordSchema>;
/**
* Create password schema
*/
export const CreatePasswordSchema = z.object({
organization_id: z.number().int().positive()
.describe('Organization ID (required)'),
name: z.string().min(1).max(255)
.describe('Password entry name (required)'),
password_category_id: z.number().int().positive().optional()
.describe('Password category ID'),
username: z.string().max(255).optional()
.describe('Username'),
password: z.string().max(10000).optional()
.describe('Password value'),
url: z.string().max(2000).optional()
.describe('URL associated with this password'),
notes: z.string().max(10000).optional()
.describe('Notes'),
password_folder_id: z.number().int().positive().optional()
.describe('Password folder ID'),
response_format: ResponseFormatSchema
}).strict();
export type CreatePasswordInput = z.infer<typeof CreatePasswordSchema>;
/**
* Update password schema
*/
export const UpdatePasswordSchema = z.object({
id: IdSchema,
organization_id: z.number().int().positive().optional()
.describe('Organization ID'),
name: z.string().min(1).max(255).optional()
.describe('Password entry name'),
password_category_id: z.number().int().positive().optional()
.describe('Password category ID'),
username: z.string().max(255).optional().nullable()
.describe('Username'),
password: z.string().max(10000).optional()
.describe('Password value'),
url: z.string().max(2000).optional().nullable()
.describe('URL associated with this password'),
notes: z.string().max(10000).optional().nullable()
.describe('Notes'),
archived: z.boolean().optional()
.describe('Archive status'),
response_format: ResponseFormatSchema
}).strict();
export type UpdatePasswordInput = z.infer<typeof UpdatePasswordSchema>;