/**
 * @aurora-catalyst-generated
 * @source cliter/iam/tag.aurora.yaml
 */
import { IamTagDto } from '@api/iam/tag';
import { IamDeleteTagByIdHandler } from '@app/iam/tag';
import { Auth } from '@aurora/decorators';
import { Auditing, AuditingMeta, Timezone } from '@aurorajs.dev/core-back';
import { QueryStatement } from '@aurorajs.dev/core-common';
import { Body, Controller, Delete, Param } from '@nestjs/common';
import { ApiOkResponse, ApiOperation, ApiTags } from '@nestjs/swagger';

@ApiTags('[iam] tag')
@Controller('iam/tag/delete')
@Auth('iam.tag.delete')
export class IamDeleteTagByIdController {
  constructor(private readonly handler: IamDeleteTagByIdHandler) {}

  @Delete(':id')
  @ApiOperation({ summary: 'Delete tag by id' })
  @ApiOkResponse({ description: 'The record has been deleted successfully.', type: IamTagDto })
  async main(
    @Param('id') id: string,
    @Body('constraint') constraint?: QueryStatement,
    @Timezone() timezone?: string,
    @Auditing() auditing?: AuditingMeta,
  ) {
    return await this.handler.main(id, constraint, {
      timezone,
      repositoryOptions: { auditing },
    });
  }
}
