/**
 * @since Last modified: 2024/06/11 17:08:52
 * @function getBullitinsTpl
 * @description Determine whether the two nodes contain or equal relationships.
 * @param  {object[]} data - List data.
 * @param  {object} [global={}] - Global paramsters.
 * @returns {boolean} Return template string.
 * @see {@link https://codepen.io/axui/pen/bGzQOYP|demo @ codepen}
 * @example
 * ax.getBullitinsTpl([{cube,label,tips,...}...],{paddingless,multiline,hoverable});
 * <!--return template string-->
 */




'use strict';
import { T_obj } from "../../../types/ax";
import prefix from "../global/prefix";
import getEl from "./getEl";
import isEmpty from "./isEmpty";

const getBullitinsTpl = (global: T_obj = {}): string => {
    
    let grid = '';
    if (global.cols > 0) {
        
        grid = global.fence ? `${prefix}grid ${prefix}fence` : `${prefix}grid`;
    }
    
    
    return `
    <ul class="${prefix}reset ${grid}">
        {{for(let k of this){/}}
            <li class="${prefix}bullitin" ${global.paddingless ? 'paddingless' : ''} ${global.hoverable ? 'hoverable' : ''}  ${global.multiline ? 'multiline' : ''}  {{k.selected?'selected':''}} {{k.disabled?'disabled':''}}>
                {{k.disk?'<span role="disk"><img src="'+k.disk+'"></span>':''}}
                {{k.cube?'<span role="cube"><img src="'+k.cube+'"></span>':''}}
                <div class="${prefix}bulletin-body">
                    {{if(k.type ==='checkbox'){/}}
                        <ax-checkbox name="{{k.name}}" {{k.checked?'check:"ed"':''}} {{k.value?'value:+k.value+':''}}>{{k.label}}</ax-checkbox>
                    {{}else if (k.type==='radio'){/}}
                        <ax-radio name="{{k.name}}" {{k.checked?'check:"ed"':''}} {{k.value?'value:+k.value+':''}}>{{k.label}}</ax-radio>
                    {{}else if(k.href){/}}
                        <a role="caption" href="{{k.href}}" {{k.target?'target:"+ k.target +"':''}} {{k.rel?'rel:"+ k.rel +"':''}}  {{k.checked?'checked':''}} {{k.value?'value:+k.value+':''}}>{{k.label}}</a>
                    {{}else{/}}
                        <span role="caption" {{k.checked?'checked':''}} {{k.value?'value:+k.value+':''}}>{{k.label}}</span>
                    {{}/}}
                </div>
                {{k.badge?'<ax-badge>'+k.badge+'</ax-badge>':''}}
                {{k.tips?'<i role="tips"><img src="'+k.tips+'"></i>':''}}
                {{k.arrow?'<i class="'+k.arrow+'" role="arrow"></i>':''}}
            </li>                
            ${global.divisible ? '<hr>' : ''}
        {{}/}}
    </ul>`;
}
export default getBullitinsTpl;
