/**
 * 通用-维保信息
 */

import React from 'react';
import moment from 'moment';
import RmInfoSummary from './RmInfoSummary';
import RmType from './RmType';
import RmMonthTrend from './RmMonthTrend';
import RmRecord from './RmRecord';
import { BaseService } from './api';
import './style';

interface TypeProps {
    id: string;
}

const RepaireMaintain: React.FC<TypeProps> = props => {
    const { id } = props;

    const date = moment().format('YYYY-MM-DD');
    const { rmSummary, rmType, rmMonthTrend } = BaseService.useRepairMaintain(id, date, date);

    return (
        <div className="repair-maintain">
            <div className="rm-head">
                <RmInfoSummary data={rmSummary} />
                <div className="rm-head-bottom">
                    <RmType data={rmType} />
                    <RmMonthTrend data={rmMonthTrend} />
                </div>
            </div>
            <div className="rm-record">
                <RmRecord id={id} />
            </div>
        </div>
    );
};

export default RepaireMaintain;
