<?php

$aValue = [
    'header' => [
        'style' => 'remarkGuide',
        'title' => '封面',
        'remark' => '',
        'value' => [
            'compute' => false,
            'imglist' => [
                dirname(__DIR__). '/image/header.jpg',
            ],
        ]
    ],
    
    'general' => [
        'style' => 'generalGuide',
        'title' => 'GENERAL INDEX',
        'remark' => 'GENERAL INDEX',
        'addon' => [
            'fontsize' => 12, // 字体大小
            'lineHeight' => 24, // 行高
        ],
        'value' => []
    ],
];

$aLabel = ['Clutch Release Bearing', 'Tensioner Bearing'];
$aTests = require __DIR__. '/model.php';
foreach ($aLabel as $sLabel)
{
    $aValue[sprintf('%s|vehicleGuide', $sLabel)] = [
        'style' => 'vehicleGuide',
        'title' => 'Vehicle Index',
        'remark' => 'Vehicle Index',
        'catalog' => $sLabel,
        'value' => []
    ];
    
    $aModel = [];
    foreach ($aTests as $aVal)
    {
        $aData = [];
        $sData = rand(1, 5);
        for ($sRun = 0; $sRun <= $sData; $sRun ++) {
            $aData[] = ['col1' => '1990.12-1994.07', 'col2' => 'Hatchback Engine AR33503/AR38501', 'col3' => 'Tensioner Bearing', 'col4' => '9710012'];
        }
        $aModel[] = array_merge($aVal, ['value' => $aData]);
    }
    $aValue[sprintf('%s|modelGuideByBearing', $sLabel)] = [
        'style' => 'modelGuideByBearing',
        'title' => 'Application',
        'remark' => 'Application',
        'catalog' => $sLabel,
        'value' => $aModel
    ];
    
    $aData = [];
    $sData = rand(10, 100);
    for ($sRun = 0; $sRun <= $sData; $sRun ++) {
        $aData[] = ['col1' => $sRun, 'col2' => 97, 'col3' => 'Ф10.5(4)', 'col4' => '56', 'col5' => '..', 'col6' => '..'];
    }
    $sStyle = ($sLabel == 'Tensioner Bearing') ? 'tensionerByBearing' : 'clutchByBearing';
    $aValue[sprintf('%s|%s', $sLabel, $sStyle)] = [
        'style' => $sStyle,
        'title' => $sLabel,
        'remark' => sprintf('%s Basic Dimension Table-GSP to Dimension', $sLabel),
        'catalog' => $sLabel,
        'value' => $aData
    ];
    
    $aData = [];
    $sData = rand(10, 30);
    for ($sRun = 0; $sRun <= $sData; $sRun ++)
    {
        $aData[] = [
            'col1' => 9710001 + $sRun,
            'col2' => [1111111, 222222, 3333333, 44444444444, 5555555555, 666666, 7777777777, 88888888, 99999999999, 0],
            'col3' => ['D=34', 'd=24', 'H=18.5', 'W=46'],
            'col4' => sprintf('%s/pic/123.bmp', dirname(__DIR__)),
        ];
    }
    $aValue[sprintf('%s|photoGuideByBearing', $sLabel)] = [
        'style' => ($sLabel == 'Tensioner Bearing') ? 'photoGuideByTensioner' : 'photoGuideByBearing',
        'title' => $sLabel,
        'remark' => 'Cross References List And Photo',
        'catalog' => $sLabel,
        'value' => $aData
    ];
    
    // 交叉号
    $aData = [];
    $aBrand = ['OE1', 'OE2', 'OE3', 'OE4', 'OE5', 'OE6', 'OE7'];
    foreach ($aBrand as $sBrand)
    {
        $sRand = rand(5, 300);
        for ($sRun = 1; $sRun < $sRand; $sRun ++) {
            $aData[] = ['col' => $sBrand, 'col1' => 'VKBA'. substr('0000'.$sRun, -4), 'col2' => '9235001K'];
        }
    }
    $aValue[sprintf('%s|cross', $sLabel)] = ['style' => 'cross1Guide', 'catalog' => $sLabel, 'title' => 'Cross Reference List', 'remark' => 'Cross Reference List', 'value' => $aData];
}
#$aValue['Clutch Release Bearing|modelGuideByBearing'] = require __DIR__. '/tests.php';

return $aValue;