import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

class RoleDto {
  @ApiProperty({ example: 'clq1234567890role1' })
  id: string;

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

  @ApiPropertyOptional({ example: 'Administrator role with full access' })
  description?: string;
}

class UserRoleDto {
  @ApiProperty({ type: RoleDto })
  role: RoleDto;
}

class DepartmentDto {
  @ApiProperty({ example: 'clq1234567890dept1' })
  id: string;

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

export class UserResponseDto {
  @ApiProperty({ example: 'clq1234567890abcdef' })
  id: string;

  @ApiProperty({ example: 'john.doe@example.com' })
  email: string;

  @ApiProperty({ example: 'John' })
  firstName: string;

  @ApiProperty({ example: 'Doe' })
  lastName: string;

  @ApiPropertyOptional({ example: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890' })
  keycloakId?: string;

  @ApiPropertyOptional({ example: 'https://example.com/avatars/john-doe.jpg' })
  avatar?: string;

  @ApiProperty({ example: true })
  isActive: boolean;

  @ApiProperty({ example: '2024-01-15T10:30:00.000Z' })
  createdAt: Date;

  @ApiProperty({ example: '2024-01-15T10:30:00.000Z' })
  updatedAt: Date;

  @ApiPropertyOptional({ type: DepartmentDto })
  department?: DepartmentDto;

  @ApiProperty({ type: [UserRoleDto] })
  roles: UserRoleDto[];
}

export class PaginatedUsersResponseDto {
  @ApiProperty({ type: [UserResponseDto] })
  data: UserResponseDto[];

  @ApiProperty({
    example: {
      total: 100,
      page: 1,
      limit: 20,
      totalPages: 5,
    },
  })
  meta: {
    total: number;
    page: number;
    limit: number;
    totalPages: number;
  };
}
