package com.sonymusic.dx.dxadvsearchservice.controllers;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.sonymusic.dx.dxadvsearchservice.service.CompanyService;

@RestController
@RequestMapping("/companies")
public class CompanyController {

	@Autowired
	private CompanyService companyService;

	@GetMapping("/getCompanyList")
	public Map<String,Object> getCompanyList(@RequestParam(required = false) String name,
										@RequestParam(defaultValue = "1")int page,
										@RequestParam(defaultValue = "20")int size,
										@RequestParam(required = false) int type){
		return companyService.getCompanyList(name,page,size,type);
	}

	@GetMapping("/maintenanceOwner")
	public Map<String,Object> getMaintenanceOwner(@RequestParam(required = false) String name,
												@RequestParam(defaultValue = "1")int page,
												@RequestParam(defaultValue = "20")int size){
		return companyService.getMaintenanceOwner(name,page,size);
	}


		@GetMapping("/initiator")
	public Map<String,Object> getInitiator(@RequestParam(required = false) String name,
												@RequestParam(defaultValue = "1")int page,
												  @RequestParam(defaultValue = "20")int size){
		return companyService.getInitiator(name,page,size);
	}
}
