<?xml version="1.0" encoding="UTF-8"?>
<!--
  범용 그리드 PDF 공용 템플릿 (전 그리드 공용 · 동적 컬럼).
  - "골격(chrome)"만 정의: KINTEX 로고·타이틀·부제·출력일시·행수·페이지 번호(X / Y).
  - columnHeader / detail 밴드는 비어 있으며, 요청 columns 개수에 맞춰 GridReportService 가
    JasperDesign API 로 정적텍스트(머리글)·텍스트필드(셀)를 런타임에 주입한 뒤 compile 한다
    (Jasper 정적 컬럼 한계 회피 — 가로 균등/가중 분할 자체 구현. DynamicJasper 미사용).
  - 데이터소스: JRMapCollectionDataSource(행=Map<String,String>). 필드 key 도 런타임 주입.
  - 한글: fontName="NanumGothic" (resources/fonts/fonts.xml 폰트확장 → Identity-H 임베딩).
  - A4 가로(842x595) — 컬럼 수 많은 그리드 대응. 좌우 여백 30 → 컨텐츠 폭 782.
-->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
              name="grid_report" pageWidth="842" pageHeight="595" orientation="Landscape"
              columnWidth="782" leftMargin="30" rightMargin="30" topMargin="30" bottomMargin="30"
              whenNoDataType="AllSectionsNoDetail">

    <parameter name="P_TITLE" class="java.lang.String"/>
    <parameter name="P_SUBTITLE" class="java.lang.String"/>
    <parameter name="P_CREATED_AT" class="java.lang.String"/>
    <parameter name="P_TOTAL_ROWS" class="java.lang.String"/>
    <!-- 로고 이미지 바이트 스트림(classpath reports/kintex_ci.jpg). null 이면 이미지 미표시. -->
    <parameter name="P_LOGO" class="java.io.InputStream" isForPrompting="false"/>

    <title>
        <band height="86" splitType="Stretch">
            <!-- KINTEX CI 로고 (311x56 비율 유지 · 좌상단) -->
            <image scaleImage="RetainShape" hAlign="Left" vAlign="Top" isUsingCache="false" onErrorType="Blank">
                <reportElement x="0" y="0" width="170" height="31"/>
                <imageExpression><![CDATA[$P{P_LOGO}]]></imageExpression>
            </image>
            <!-- 타이틀 -->
            <textField isBlankWhenNull="true">
                <reportElement x="0" y="36" width="620" height="26"/>
                <textElement verticalAlignment="Middle">
                    <font fontName="NanumGothic" size="17" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{P_TITLE}]]></textFieldExpression>
            </textField>
            <!-- 부제 -->
            <textField isBlankWhenNull="true">
                <reportElement x="0" y="63" width="620" height="16"/>
                <textElement verticalAlignment="Middle">
                    <font fontName="NanumGothic" size="9.5"/>
                    <paragraph/>
                </textElement>
                <textFieldExpression><![CDATA[$P{P_SUBTITLE}]]></textFieldExpression>
            </textField>
            <!-- 출력일시 -->
            <textField isBlankWhenNull="true">
                <reportElement x="562" y="6" width="220" height="14"/>
                <textElement textAlignment="Right" verticalAlignment="Middle">
                    <font fontName="NanumGothic" size="8.5"/>
                </textElement>
                <textFieldExpression><![CDATA["출력일시  " + $P{P_CREATED_AT}]]></textFieldExpression>
            </textField>
            <!-- 총 행수 -->
            <textField isBlankWhenNull="true">
                <reportElement x="562" y="21" width="220" height="14"/>
                <textElement textAlignment="Right" verticalAlignment="Middle">
                    <font fontName="NanumGothic" size="8.5"/>
                </textElement>
                <textFieldExpression><![CDATA["총 " + $P{P_TOTAL_ROWS} + " 건"]]></textFieldExpression>
            </textField>
            <!-- 상단 구분선(브랜드 컬러) -->
            <line>
                <reportElement x="0" y="83" width="782" height="1"/>
                <graphicElement>
                    <pen lineWidth="1.5" lineColor="#1F29FC"/>
                </graphicElement>
            </line>
        </band>
    </title>

    <!-- columnHeader / detail 은 비워둔다(런타임 주입). height 는 서비스가 재설정. -->
    <columnHeader>
        <band height="22" splitType="Prevent"/>
    </columnHeader>

    <detail>
        <band height="18" splitType="Prevent"/>
    </detail>

    <pageFooter>
        <band height="22" splitType="Stretch">
            <line>
                <reportElement x="0" y="2" width="782" height="1"/>
                <graphicElement>
                    <pen lineWidth="0.5" lineColor="#B8BFCE"/>
                </graphicElement>
            </line>
            <textField isBlankWhenNull="true">
                <reportElement x="0" y="6" width="400" height="14"/>
                <textElement verticalAlignment="Middle">
                    <font fontName="NanumGothic" size="8"/>
                </textElement>
                <textFieldExpression><![CDATA["KINTEX AI 전시·행사시스템"]]></textFieldExpression>
            </textField>
            <textField evaluationTime="Now">
                <reportElement x="602" y="6" width="150" height="14"/>
                <textElement textAlignment="Right" verticalAlignment="Middle">
                    <font fontName="NanumGothic" size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$V{PAGE_NUMBER} + " / "]]></textFieldExpression>
            </textField>
            <textField evaluationTime="Report">
                <reportElement x="752" y="6" width="30" height="14"/>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="NanumGothic" size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression>
            </textField>
        </band>
    </pageFooter>
</jasperReport>
