package sgc.portal.sample.component.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import sgc.portal.base.util.EasyHashMap;
import sgc.portal.sample.component.model.Create;
import sgc.portal.sample.component.model.Sample;
import sgc.portal.sample.component.model.Spec;
import sgc.portal.sample.component.service.ComSampleService;

@RestController
public class ComSampleController {

    @Autowired
    private ComSampleService comSampleService;

    @PostMapping(value = "/select")
    public List<Sample> select() {

        return comSampleService.select();
    }

    @PostMapping(value = "/selectBigSpec")
    public List<Spec> selectBigSpec() {

        return comSampleService.selectBigSpec();
    }

    @PostMapping(value = "/selectMidSpec")
    public List<Spec> selectMidSpec() {

        return comSampleService.selectMidSpec();
    }

    @PostMapping(value = "/selectSmlSpec")
    public List<Spec> selectSmlSpec() {

        return comSampleService.selectSmlSpec();
    }

    @PostMapping(value = "/selectAllCommCd")
    public List<EasyHashMap<String,String>> selectAllCommCd() {

        return comSampleService.selectAllCommCd();
    }

    @PostMapping(value = "/create")
    public Create qrCodeSample(@RequestBody Create create) {

        String ret = comSampleService.qrCodeSample(create.getKey());
        return new Create(ret);
    }

    @PostMapping(value = "/pdf417")
    public Create pdf417CodeSample(@RequestBody Create create) {

        String ret = comSampleService.pdf417CodeSample(create.getKey());
        return new Create(ret);
    }

}
