import { CliFlagInput, CliLeaf } from '@alwaysai/alwayscli';
import { modelIdCliInput } from '../../../cli-inputs';
import { appModelsRemoveComponent } from '../../../components/app';

export const removeModels = CliLeaf({
  name: 'remove',
  description: `Remove a model from this application`,
  positionalInput: modelIdCliInput,
  namedInputs: {
    purge: CliFlagInput({
      description: 'Purge the model files from the application target directory'
    }),
    'remove-from-project': CliFlagInput({
      description: 'Remove the model from the project'
    })
  },
  async action(id, { purge, 'remove-from-project': removeFromProject }) {
    await appModelsRemoveComponent({ id, purge, removeFromProject });
  }
});
