import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
import { RolesService } from './roles.service';
import { ApiTags, ApiOperation, ApiResponse, ApiProperty } from '@nestjs/swagger';
import { ErrorResponse500 } from 'src/appointment_status/appointment_status.controller';



export class RolesDto {
  @ApiProperty({ example: 1 })
  id: number;

  @ApiProperty({ example: 'Admin' })
  name: string;

  @ApiProperty({ example: null, nullable: true })
  slug: string | null;

  @ApiProperty({ example: 0 })
  is_active: number;

  @ApiProperty({ example: 1 })
  is_system: number;

  @ApiProperty({ example: 0 })
  is_superadmin: number;

  @ApiProperty({ example: '2018-12-25T06:19:43.000Z' })
  created_at: string;
}

@ApiTags('Roles')
@Controller('roles')
export class RolesController {
  constructor(private readonly rolesService: RolesService) {}

 
  @Get()
  @ApiOperation({ summary: 'Retrieve all roles' }) 
  @ApiResponse({
    status: 200,
    description: 'List of all roles',
    type: [RolesDto], 
  })
  @ApiResponse({
    status: 500,
    description: 'Internal server error',
    type: ErrorResponse500, 
  })
  findAll() {
    return this.rolesService.findAll();
  }
}
