package service

import (
	"x-agents/server/internal/model"
	"x-agents/server/internal/repository"
)

type MCPService struct {
	mcpRepo *repository.MCPRepository
}

func NewMCPService(mcpRepo *repository.MCPRepository) *MCPService {
	return &MCPService{mcpRepo: mcpRepo}
}

func (s *MCPService) GetAllMCPs() ([]model.MCP, error) {
	return s.mcpRepo.FindAll()
}

func (s *MCPService) GetMCPByID(id string) (*model.MCP, error) {
	return s.mcpRepo.FindByID(id)
}

func (s *MCPService) GetMCPByName(name string) (*model.MCP, error) {
	return s.mcpRepo.FindByName(name)
}

func (s *MCPService) GetMCPsByCategory(category string) ([]model.MCP, error) {
	return s.mcpRepo.FindByCategory(category)
}

func (s *MCPService) CreateMCP(mcp *model.MCP) error {
	return s.mcpRepo.Create(mcp)
}

func (s *MCPService) UpdateMCP(mcp *model.MCP) error {
	return s.mcpRepo.Update(mcp)
}

func (s *MCPService) DeleteMCP(id string) error {
	return s.mcpRepo.Delete(id)
}
