import { ListItem } from './ListItem'; export interface NoteListProps { id: string; title: string; category: string; // 'movies', 'shopping', 'tasks', 'general' description?: string; color?: string | null; icon?: string | null; ownerId: string; createdAt: Date; updatedAt: Date; items?: ListItem[]; } export class NoteList { constructor(private readonly props: NoteListProps) {} public get id(): string { return this.props.id; } public get title(): string { return this.props.title; } public get category(): string { return this.props.category; } public get description(): string { return this.props.description || ''; } public get color(): string | null | undefined { return this.props.color; } public get icon(): string | null | undefined { return this.props.icon; } public get ownerId(): string { return this.props.ownerId; } public get createdAt(): Date { return this.props.createdAt; } public get updatedAt(): Date { return this.props.updatedAt; } public get items(): ListItem[] { return this.props.items || []; } public addItem(item: ListItem): void { if (!this.props.items) { this.props.items = []; } this.props.items.push(item); this.props.updatedAt = new Date(); } public toJSON(): NoteListProps { return { ...this.props, items: this.props.items?.map(i => i.toJSON()) }; } }