package top.imwork.window.silos.controller.cms.books.view;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Copyright (C), 2015-2025
 * FileName: BookViewController
 * Author<作者姓名>:   stars
 * CreateTime<创建时间>:   2025/11/4 13:26
 * UpdateTime<修改时间>:   2025/11/4 13:26
 * Description〈功能简述〉: 图书管理视图控制器
 * History<历史描述>:
 * Since<版本号>: 1.0.0
 */
@RequestMapping("/cms/book/")
@Controller
public class BookViewController {
    @GetMapping("/category/list.html")
    public String categoryList() {
        return "/cms/book/category/list";
    }

    @GetMapping("/category/edit.html")
    public String categoryEdit() {
        return "/cms/book/category/edit";
    }

    @GetMapping("/info/list.html")
    public String infoList() {
        return "/cms/book/info/list";
    }

    @GetMapping("/info/edit.html")
    public String infoEdit() {
        return "/cms/book/info/edit";
    }

    @GetMapping("/info/update.html/{id}")
    public String update(@PathVariable("id") Long id, Model model) {
        model.addAttribute("bookInfoId", id);
        return "/cms/book/info/update";
    }

    @GetMapping("/contents/list.html")
    public String contentsList() {
        return "/cms/book/contents/list";
    }

    @GetMapping("/contents/edit.html")
    public String contentsEdit() {
        return "/cms/book/contents/edit";
    }

    @GetMapping("/chapter/chapter.html/{id}")
    public String chapter(@PathVariable("id") Long id, Model model) {
        model.addAttribute("bookId", id);
        return "/cms/book/chapter/chapter";
    }
}