import { ApiProperty } from '@nestjs/swagger';
import type { TagGroup as PrismaTagGroup } from '@prisma/client';

export class PublicTagGroupDto {
  @ApiProperty()
  id!: string;

  @ApiProperty()
  groupName!: string;

  @ApiProperty({ nullable: true })
  groupIcon!: string | null;

  @ApiProperty({ nullable: true })
  groupColor!: string | null;

  @ApiProperty()
  sortOrder!: number;

  static from(g: PrismaTagGroup): PublicTagGroupDto {
    return {
      id: g.id.toString(),
      groupName: g.groupName,
      groupIcon: g.groupIcon,
      groupColor: g.groupColor,
      sortOrder: g.sortOrder,
    };
  }
}
