import Foundation

// MARK: - Mock data for SwiftUI Previews and unit tests

extension ShelfDTO {
    static let mock = ShelfDTO(
        id: 1,
        name: "Engineering Docs",
        slug: "engineering-docs",
        description: "Internal technical documentation for all engineering teams",
        createdAt: Date(),
        updatedAt: Date(),
        cover: nil
    )

    static let mockList: [ShelfDTO] = [
        mock,
        ShelfDTO(id: 2, name: "Project Alpha", slug: "project-alpha", description: "Documentation for Project Alpha", createdAt: Date(), updatedAt: Date(), cover: nil),
        ShelfDTO(id: 3, name: "HR Policies", slug: "hr-policies", description: "Company policies and procedures", createdAt: Date(), updatedAt: Date(), cover: nil)
    ]
}

extension BookDTO {
    static let mock = BookDTO(
        id: 1,
        name: "iOS Development Guide",
        slug: "ios-dev",
        description: "Best practices for building iOS apps",
        createdAt: Date(),
        updatedAt: Date(),
        cover: nil
    )

    static let mockList: [BookDTO] = [
        mock,
        BookDTO(id: 2, name: "API Reference", slug: "api-reference", description: "Complete API documentation", createdAt: Date(), updatedAt: Date(), cover: nil),
        BookDTO(id: 3, name: "Onboarding Guide", slug: "onboarding", description: "Getting started for new team members", createdAt: Date(), updatedAt: Date(), cover: nil)
    ]
}

extension ChapterDTO {
    static let mock = ChapterDTO(
        id: 1,
        bookId: 1,
        name: "Getting Started",
        slug: "getting-started",
        description: "Introduction and setup",
        priority: 1,
        createdAt: Date(),
        updatedAt: Date()
    )
}

extension PageDTO {
    static let mock = PageDTO(
        id: 1,
        bookId: 1,
        chapterId: 1,
        name: "Installation",
        slug: "installation",
        html: "<h1>Installation</h1><p>Welcome to the guide. Follow these steps to get started.</p><ul><li>Install Xcode</li><li>Clone the repository</li><li>Run the app</li></ul>",
        markdown: "# Installation\n\nWelcome to the guide. Follow these steps to get started.\n\n- Install Xcode\n- Clone the repository\n- Run the app",
        priority: 1,
        draftStatus: false,
        tags: [TagDTO(name: "status", value: "draft", order: 0)],
        createdAt: Date(),
        updatedAt: Date()
    )

    static let mockList: [PageDTO] = [
        mock,
        PageDTO(id: 2, bookId: 1, chapterId: 1, name: "Configuration", slug: "configuration", html: "<h1>Configuration</h1><p>Configure your environment.</p>", markdown: "# Configuration\n\nConfigure your environment.", priority: 2, draftStatus: false, tags: [], createdAt: Date(), updatedAt: Date()),
        PageDTO(id: 3, bookId: 1, chapterId: nil, name: "Deployment", slug: "deployment", html: "<h1>Deployment</h1><p>Deploy to production.</p>", markdown: "# Deployment\n\nDeploy to production.", priority: 3, draftStatus: false, tags: [], createdAt: Date(), updatedAt: Date())
    ]
}

extension SearchResultDTO {
    static let mock = SearchResultDTO(
        id: 1,
        name: "Installation Guide",
        slug: "installation",
        type: .page,
        url: "/books/1/page/installation",
        preview: "Welcome to the guide. Follow these steps to get started...",
        tags: [TagDTO(name: "status", value: "draft", order: 0)]
    )

    static let mockList: [SearchResultDTO] = [
        mock,
        SearchResultDTO(id: 2, name: "iOS Development Guide", slug: "ios-dev", type: .book, url: "/books/2", preview: nil, tags: []),
        SearchResultDTO(id: 3, name: "Getting Started", slug: "getting-started", type: .chapter, url: "/books/1/chapter/getting-started", preview: nil, tags: []),
        SearchResultDTO(id: 4, name: "Engineering Docs", slug: "engineering-docs", type: .shelf, url: "/shelves/engineering-docs", preview: nil, tags: [])
    ]
}

extension CommentDTO {
    static let mock = CommentDTO(
        id: 1,
        html: "<p>Great documentation! Very helpful.</p>",
        pageId: 1,
        createdBy: UserSummaryDTO(id: 1, name: "Alice Johnson", avatarUrl: nil),
        createdAt: Date(),
        updatedAt: Date()
    )
}

extension UserDTO {
    static let mock = UserDTO(
        id: 1,
        name: "Alice Johnson",
        email: "alice@example.com",
        avatarUrl: nil
    )
}
