import {
  IsDefined,
  IsInt,
  IsBoolean,
} from "class-validator";
import { Transform, Type } from "class-transformer";
import { ApiProperty } from "@nestjs/swagger";
import { toBoolean } from "src/common/cast";

export class UpdateRolePermissionDto {
  @ApiProperty({ example: "1", description: "id of permissions you want add" })
  @IsDefined()
  @IsInt()
  permission_id: number;
  
  @ApiProperty({
    example: true,
    description: "Set true if you want to activate this role",
    required: false,
  })
  @Transform(({ value }) => toBoolean(value))
  @IsDefined()
  @IsBoolean()
  active?: boolean;
}
