// Path: src/main/java/com/maxmind/geoip2/NetworkDeserializer.java
// public class NetworkDeserializer extends StdDeserializer<Network> {
// 
//     public NetworkDeserializer() {
//         this(null);
//     }
// 
//     public NetworkDeserializer(Class<?> vc) {
//         super(vc);
//     }
// 
//     @Override
//     public Network deserialize(
//             JsonParser jsonparser, DeserializationContext context)
//             throws IOException {
// 
//         String cidr = jsonparser.getText();
//         if (cidr == null) {
//             return null;
//         }
//         String[] parts = cidr.split("/", 2);
//         if (parts.length != 2) {
//             throw new RuntimeException("Invalid cidr format: " + cidr);
//         }
//         int prefixLength = Integer.parseInt(parts[1]);
//         try {
//             return new Network(InetAddress.getByName(parts[0]), prefixLength);
//         } catch (UnknownHostException e) {
//             throw new RuntimeException(e);
//         }
//     }
// }


import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.maxmind.db.MaxMindDbConstructor;
import com.maxmind.db.MaxMindDbParameter;
import com.maxmind.db.Network;
import com.maxmind.geoip2.NetworkDeserializer;
package com.maxmind.geoip2.model;


/**
 * This class provides the GeoLite2 ASN model.
 */
public class AsnResponse extends AbstractResponse {

    private final Long autonomousSystemNumber;
    private final String autonomousSystemOrganization;
    private final String ipAddress;
    private final Network network;

    @MaxMindDbConstructor
    public AsnResponse(
            @JsonProperty("autonomous_system_number") @MaxMindDbParameter(name = "autonomous_system_number") Long autonomousSystemNumber,
            @JsonProperty("autonomous_system_organization") @MaxMindDbParameter(name = "autonomous_system_organization") String autonomousSystemOrganization,
            @JacksonInject("ip_address") @JsonProperty("ip_address") @MaxMindDbParameter(name = "ip_address") String ipAddress,
// Path: src/main/java/com/maxmind/geoip2/NetworkDeserializer.java
// public class NetworkDeserializer extends StdDeserializer<Network> {
// 
//     public NetworkDeserializer() {
//         this(null);
//     }
// 
//     public NetworkDeserializer(Class<?> vc) {
//         super(vc);
//     }
// 
//     @Override
//     public Network deserialize(
//             JsonParser jsonparser, DeserializationContext context)
//             throws IOException {
// 
//         String cidr = jsonparser.getText();
//         if (cidr == null) {
//             return null;
//         }
//         String[] parts = cidr.split("/", 2);
//         if (parts.length != 2) {
//             throw new RuntimeException("Invalid cidr format: " + cidr);
//         }
//         int prefixLength = Integer.parseInt(parts[1]);
//         try {
//             return new Network(InetAddress.getByName(parts[0]), prefixLength);
//         } catch (UnknownHostException e) {
//             throw new RuntimeException(e);
//         }
//     }
// }


// Path: src/main/java/com/maxmind/geoip2/model/AsnResponse.java
import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.maxmind.db.MaxMindDbConstructor;
import com.maxmind.db.MaxMindDbParameter;
import com.maxmind.db.Network;
import com.maxmind.geoip2.NetworkDeserializer;

package com.maxmind.geoip2.model;


/**
 * This class provides the GeoLite2 ASN model.
 */
public class AsnResponse extends AbstractResponse {

    private final Long autonomousSystemNumber;
    private final String autonomousSystemOrganization;
    private final String ipAddress;
    private final Network network;

    @MaxMindDbConstructor
    public AsnResponse(
            @JsonProperty("autonomous_system_number") @MaxMindDbParameter(name = "autonomous_system_number") Long autonomousSystemNumber,
            @JsonProperty("autonomous_system_organization") @MaxMindDbParameter(name = "autonomous_system_organization") String autonomousSystemOrganization,
            @JacksonInject("ip_address") @JsonProperty("ip_address") @MaxMindDbParameter(name = "ip_address") String ipAddress,
            @JacksonInject("network") @JsonProperty("network") @JsonDeserialize(using = NetworkDeserializer.class) @MaxMindDbParameter(name = "network") Network network