import type { IAccessor, ICommand } from '@univerjs/core';

import { CommandType } from '@univerjs/core';

import { JnpfSheetsFloatEchartService } from '../../services/sheet-float-echart.service';
import { JnpfCommandIds } from '../../utils/define';

export const JnpfSheetsInsertedFloatEchartOperation: ICommand = {
  handler: async (_: IAccessor) => {
    return true;
  },
  id: JnpfCommandIds.insertedFloatEchart,
  type: CommandType.OPERATION,
};

export const JnpfSheetsInsertFloatBarEchartOperation: ICommand = {
  handler: async (accessor: IAccessor) => {
    const jnpfSheetsFloatEchartService = accessor.get(JnpfSheetsFloatEchartService);
    jnpfSheetsFloatEchartService.insertFloatEchart('JnpfUniverFloatBarEchart');

    return true;
  },
  id: JnpfCommandIds.insertFloatBarEchart,
  type: CommandType.OPERATION,
};

export const JnpfSheetsInsertFloatLineEchartOperation: ICommand = {
  handler: async (accessor: IAccessor) => {
    const jnpfSheetsFloatEchartService = accessor.get(JnpfSheetsFloatEchartService);
    jnpfSheetsFloatEchartService.insertFloatEchart('JnpfUniverFloatLineEchart');

    return true;
  },
  id: JnpfCommandIds.insertFloatLineEchart,
  type: CommandType.OPERATION,
};

export const JnpfSheetsInsertFloatPieEchartOperation: ICommand = {
  handler: async (accessor: IAccessor) => {
    const jnpfSheetsFloatEchartService = accessor.get(JnpfSheetsFloatEchartService);
    jnpfSheetsFloatEchartService.insertFloatEchart('JnpfUniverFloatPieEchart');

    return true;
  },
  id: JnpfCommandIds.insertFloatPieEchart,
  type: CommandType.OPERATION,
};

export const JnpfSheetsInsertFloatRadarEchartOperation: ICommand = {
  handler: async (accessor: IAccessor) => {
    const jnpfSheetsFloatEchartService = accessor.get(JnpfSheetsFloatEchartService);
    jnpfSheetsFloatEchartService.insertFloatEchart('JnpfUniverFloatRadarEchart');

    return true;
  },
  id: JnpfCommandIds.insertFloatRadarEchart,
  type: CommandType.OPERATION,
};

export const JnpfSheetsFocusEchartOperation: ICommand = {
  handler: async (_: IAccessor) => {
    return true;
  },
  id: JnpfCommandIds.focusFloatEchart,
  type: CommandType.OPERATION,
};
