package ru.kirillius.pf.sdn.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import ru.kirillius.pf.sdn.api.Networking.IPv4Subnet;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addFormatters(FormatterRegistry registry) {
        registry.addConverter(String.class, IPv4Subnet.class, IPv4Subnet::new);
        registry.addConverter(IPv4Subnet.class, String.class, IPv4Subnet::toString);
    }
}
