use lmrc_cloudflare::dns::{DnsRecordBuilder, RecordType};

#[test]
fn test_record_type_as_str() {
    assert_eq!(RecordType::A.as_str(), "A");
    assert_eq!(RecordType::AAAA.as_str(), "AAAA");
    assert_eq!(RecordType::CNAME.as_str(), "CNAME");
    assert_eq!(RecordType::MX.as_str(), "MX");
    assert_eq!(RecordType::TXT.as_str(), "TXT");
    assert_eq!(RecordType::SRV.as_str(), "SRV");
    assert_eq!(RecordType::NS.as_str(), "NS");
    assert_eq!(RecordType::CAA.as_str(), "CAA");
    assert_eq!(RecordType::PTR.as_str(), "PTR");
    assert_eq!(RecordType::DNSKEY.as_str(), "DNSKEY");
    assert_eq!(RecordType::DS.as_str(), "DS");
    assert_eq!(RecordType::HTTPS.as_str(), "HTTPS");
    assert_eq!(RecordType::LOC.as_str(), "LOC");
    assert_eq!(RecordType::NAPTR.as_str(), "NAPTR");
    assert_eq!(RecordType::SMIMEA.as_str(), "SMIMEA");
    assert_eq!(RecordType::SSHFP.as_str(), "SSHFP");
    assert_eq!(RecordType::SVCB.as_str(), "SVCB");
    assert_eq!(RecordType::TLSA.as_str(), "TLSA");
    assert_eq!(RecordType::URI.as_str(), "URI");
}

#[test]
fn test_record_type_display() {
    assert_eq!(format!("{}", RecordType::A), "A");
    assert_eq!(format!("{}", RecordType::HTTPS), "HTTPS");
    assert_eq!(format!("{}", RecordType::SVCB), "SVCB");
}

#[test]
fn test_record_type_equality() {
    assert_eq!(RecordType::A, RecordType::A);
    assert_ne!(RecordType::A, RecordType::AAAA);
    assert_eq!(RecordType::HTTPS, RecordType::HTTPS);
}

#[test]
fn test_record_builder_basic() {
    // Test that builder methods work and can be chained
    let _builder = DnsRecordBuilder::new()
        .name("example.com")
        .record_type(RecordType::A)
        .content("192.0.2.1");
    // Builder should compile and work
}

#[test]
fn test_record_builder_with_proxied() {
    let _builder = DnsRecordBuilder::new()
        .name("example.com")
        .record_type(RecordType::A)
        .content("192.0.2.1")
        .proxied(true);
    // Builder should compile and work
}

#[test]
fn test_record_builder_with_ttl() {
    let _builder = DnsRecordBuilder::new()
        .name("example.com")
        .record_type(RecordType::A)
        .content("192.0.2.1")
        .ttl(3600);
    // Builder should compile and work
}

#[test]
fn test_record_builder_with_priority() {
    let _builder = DnsRecordBuilder::new()
        .name("mail.example.com")
        .record_type(RecordType::MX)
        .content("mail.example.com")
        .priority(10);
    // Builder should compile and work
}

#[test]
fn test_record_builder_with_comment() {
    let _builder = DnsRecordBuilder::new()
        .name("example.com")
        .record_type(RecordType::A)
        .content("192.0.2.1")
        .comment("Production server");
    // Builder should compile and work
}

#[test]
fn test_record_builder_all_dns_types() {
    // Test that all record types can be used with the builder
    let types = vec![
        RecordType::A,
        RecordType::AAAA,
        RecordType::CNAME,
        RecordType::MX,
        RecordType::TXT,
        RecordType::SRV,
        RecordType::NS,
        RecordType::CAA,
        RecordType::PTR,
        RecordType::DNSKEY,
        RecordType::DS,
        RecordType::HTTPS,
        RecordType::LOC,
        RecordType::NAPTR,
        RecordType::SMIMEA,
        RecordType::SSHFP,
        RecordType::SVCB,
        RecordType::TLSA,
        RecordType::URI,
    ];

    for record_type in types {
        let _builder = DnsRecordBuilder::new()
            .name("test.example.com")
            .record_type(record_type)
            .content("test-content");
        // Should compile for all record types
    }
}

#[test]
fn test_record_builder_is_cloneable() {
    let builder = DnsRecordBuilder::new()
        .name("example.com")
        .record_type(RecordType::A)
        .content("192.0.2.1");

    let _cloned = builder.clone();
    // Should compile
}

#[test]
fn test_record_builder_chaining() {
    let _builder = DnsRecordBuilder::new()
        .name("example.com")
        .record_type(RecordType::A)
        .content("192.0.2.1")
        .proxied(true)
        .ttl(3600)
        .comment("Test record");
    // Should compile with all methods chained
}
