import {Body, Controller, Get, Param, Post} from '@nestjs/common';
import {FeatureflagService} from "./featureflag.service";

@Controller('featureflag')
export class FeatureflagController {
  constructor(private featureflagService: FeatureflagService) {
  }

  @Get(':ffname')
  async getFeatureFlag(@Param() params: { ffname: string}) {
    return await this.featureflagService.getFeatureFlag(params.ffname);
  }

  @Post()
  async setFeatureFlag(@Body() ffState: { name: string, state: boolean }) {
    return await this.featureflagService.setFeatureFlag(ffState.name, ffState.state );
  }
}
