use pdfmake_rust::{Document, DocumentNode, PdfMake, SectionNode};

#[test]
fn test_section_with_custom_header() {
    let doc = Document::builder()
        .content(DocumentNode::section(
            SectionNode::new(vec![DocumentNode::text("Section content")])
                .header(DocumentNode::text("Section Header"))
                .build(),
        ))
        .header(DocumentNode::text("Global Header"))
        .build();

    let pdf = PdfMake::new().render(&doc).unwrap();
    assert!(!pdf.is_empty());
}

#[test]
fn test_section_inherits_global_footer() {
    let doc = Document::builder()
        .content(DocumentNode::section(
            SectionNode::new(vec![DocumentNode::text("Section content")]).build(),
        ))
        .footer(DocumentNode::text("Global Footer"))
        .build();

    let pdf = PdfMake::new().render(&doc).unwrap();
    assert!(!pdf.is_empty());
}

#[test]
fn test_multiple_sections_different_headers() {
    let doc = Document::builder()
        .content(DocumentNode::section(
            SectionNode::new(vec![DocumentNode::text("Section 1")])
                .header(DocumentNode::text("Header 1"))
                .build(),
        ))
        .content(DocumentNode::section(
            SectionNode::new(vec![DocumentNode::text("Section 2")])
                .header(DocumentNode::text("Header 2"))
                .build(),
        ))
        .build();

    let pdf = PdfMake::new().render(&doc).unwrap();
    assert!(!pdf.is_empty());
}
