===== CHUNK 1 =====
// @ts-nocheck
// Sample TypeScript code for testing chunking behavior
// This is a test fixture representing typical code structure

export interface User {
===== CHUNK 2 =====
export interface User {
	id: string;
	name: string;
	email: string;
	createdAt: Date;
===== CHUNK 3 =====
	createdAt: Date;
	updatedAt: Date;
}

export interface Post {
===== CHUNK 4 =====
export interface Post {
	id: string;
	title: string;
	content: string;
	authorId: string;
===== CHUNK 5 =====
	authorId: string;
	tags: string[];
	published: boolean;
	publishedAt?: Date;
	createdAt: Date;
===== CHUNK 6 =====
	createdAt: Date;
	updatedAt: Date;
}

export class UserService {
===== CHUNK 7 =====
export class UserService {
	constructor(private readonly db: Database) {}

	async findById(id: string): Promise<User | null> {
		const user = await this.db.users.findUnique({
===== CHUNK 8 =====
		const user = await this.db.users.findUnique({
			where: { id },
		});
		return user;
	}
===== CHUNK 9 =====
	}

	async findByEmail(email: string): Promise<User | null> {
		const user = await this.db.users.findUnique({
			where: { email },
===== CHUNK 10 =====
			where: { email },
		});
		return user;
	}

===== CHUNK 11 =====

	async create(data: CreateUserInput): Promise<User> {
		const user = await this.db.users.create({
			data: {
				...data,
===== CHUNK 12 =====
				...data,
				createdAt: new Date(),
				updatedAt: new Date(),
			},
		});
===== CHUNK 13 =====
		});
		return user;
	}

	async update(id: string, data: UpdateUserInput): Promise<User> {
===== CHUNK 14 =====
	async update(id: string, data: UpdateUserInput): Promise<User> {
		const user = await this.db.users.update({
			where: { id },
			data: {
				...data,
===== CHUNK 15 =====
				...data,
				updatedAt: new Date(),
			},
		});
		return user;
===== CHUNK 16 =====
		return user;
	}

	async delete(id: string): Promise<void> {
		await this.db.users.delete({
===== CHUNK 17 =====
		await this.db.users.delete({
			where: { id },
		});
	}
}
===== CHUNK 18 =====
}

export class PostService {
	constructor(private readonly db: Database) {}

===== CHUNK 19 =====

	async findById(id: string): Promise<Post | null> {
		const post = await this.db.posts.findUnique({
			where: { id },
			include: { author: true },
===== CHUNK 20 =====
			include: { author: true },
		});
		return post;
	}

===== CHUNK 21 =====

	async findByAuthor(authorId: string): Promise<Post[]> {
		const posts = await this.db.posts.findMany({
			where: { authorId },
			orderBy: { createdAt: "desc" },
===== CHUNK 22 =====
			orderBy: { createdAt: "desc" },
		});
		return posts;
	}

===== CHUNK 23 =====

	async findPublished(): Promise<Post[]> {
		const posts = await this.db.posts.findMany({
			where: { published: true },
			orderBy: { publishedAt: "desc" },
===== CHUNK 24 =====
			orderBy: { publishedAt: "desc" },
		});
		return posts;
	}

===== CHUNK 25 =====

	async create(data: CreatePostInput): Promise<Post> {
		const post = await this.db.posts.create({
			data: {
				...data,
===== CHUNK 26 =====
				...data,
				createdAt: new Date(),
				updatedAt: new Date(),
			},
		});
===== CHUNK 27 =====
		});
		return post;
	}

	async publish(id: string): Promise<Post> {
===== CHUNK 28 =====
	async publish(id: string): Promise<Post> {
		const post = await this.db.posts.update({
			where: { id },
			data: {
				published: true,
===== CHUNK 29 =====
				published: true,
				publishedAt: new Date(),
				updatedAt: new Date(),
			},
		});
===== CHUNK 30 =====
		});
		return post;
	}
}

===== CHUNK 31 =====

// Database interface
interface Database {
	users: unknown;
	posts: unknown;
===== CHUNK 32 =====
	posts: unknown;
}

// Input types
interface CreateUserInput {
===== CHUNK 33 =====
interface CreateUserInput {
	name: string;
	email: string;
}

===== CHUNK 34 =====

interface UpdateUserInput {
	name?: string;
	email?: string;
}
===== CHUNK 35 =====
}

interface CreatePostInput {
	title: string;
	content: string;
===== CHUNK 36 =====
	content: string;
	authorId: string;
	tags: string[];
}
