import React from 'react';
import { Collapse, Tabs } from 'antd';
import Style from './web.module.less';
import ActionAuthList from '../../actionAuth';
import RelationAuthList from '../../relationAuth';
export default function render(props) {
    const { path, oakFullpath, actions, relations, destRelations } = props.data;
    const { t, execute, addItem, clean, navigateTo } = props.methods;
    const header = <div className={Style.header}>
        <div>
            {path?.value}
        </div>
        <div>
            {path?.desc}
        </div>
    </div>;
    console.log(oakFullpath);
    const items = [
        {
            key: 'actionAuth',
            label: 'actionAuth',
            children: <ActionAuthList oakPath={`${path?.id}-actionAuth/list`} oakAutoUnmount={true} relations={relations} actions={actions} pathId={path?.id}/>,
        },
    ];
    if (relations.length > 0 && destRelations.length > 0) {
        items.push({
            key: 'relationAuth',
            label: 'relationAuth',
            children: <RelationAuthList oakPath={`${path?.id}-relationAuth/list`} oakAutoUnmount={true} sourceRelations={relations} destRelations={destRelations} pathId={path?.id}/>,
        });
    }
    const children = <Tabs defaultActiveKey="actionAuth" items={items}/>;
    if (oakFullpath) {
        return (<>
                <Collapse items={[{ key: `${path?.id}`, label: header, children }]} ghost/>
            </>);
    }
    return null;
}
