package com.backendsys.modules.material.controller;

import com.backendsys.modules.common.config.security.annotations.Anonymous;
import com.backendsys.modules.common.utils.Result;
import com.backendsys.modules.material.entity.MaterialLora;
import com.backendsys.modules.material.service.MaterialLoraService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Validated
@RestController
@Tag(name = "素材风格管理")
public class MaterialLoraController {

    @Autowired
    private MaterialLoraService materialLoraService;

    @Anonymous
    @Operation(summary = "获取素材风格列表")
    @GetMapping("/api/material/getMaterialLoraList")
    public Result getMaterialLoraList(@Validated(MaterialLora.LoraList.class) MaterialLora materialLora) {
        return Result.success().put("data", materialLoraService.selectMaterialLoraList(materialLora));
    }

    @Anonymous
    @Operation(summary = "获取素材风格列表(下拉)")
    @GetMapping("/api/material/getMaterialLoraPopover")
    public Result getMaterialLoraPopover(@Validated(MaterialLora.LoraList.class) MaterialLora materialLora) {
        return Result.success().put("data", materialLoraService.selectMaterialLoraPopover(materialLora));
    }

}
