import { z } from "zod";

import { arrayOrEmpty, booleanOrFalse, numberOrZero } from "../nullable-defaults";

export const CharacterCapabilitiesResponseSchema = z
  .object({
    chat: booleanOrFalse,
    privateContent: booleanOrFalse,
  })
  .readonly();

export const CharacterListItemSchema = z
  .object({
    id: z.string().min(1),
    displayName: z.string().min(1),
    isActive: booleanOrFalse,
    capabilities: CharacterCapabilitiesResponseSchema,
    sortOrder: numberOrZero,
  })
  .readonly();

export const CharacterListResponseSchema = z
  .object({
    items: arrayOrEmpty(CharacterListItemSchema),
    defaultCharacterId: z.string().min(1),
  })
  .readonly();

export type CharacterListItem = z.output<typeof CharacterListItemSchema>;
export type CharacterListResponseInput = z.input<typeof CharacterListResponseSchema>;
export type CharacterListResponse = z.output<typeof CharacterListResponseSchema>;
