import { ApiProperty } from '@nestjs/swagger';
import { PlanType } from '../entities/client.entity';
import { UserResponseDto } from 'modules/user/dto/user-response.dto';
import { RoleResponseDto } from 'modules/role-permission/roles/dto/role-response.dto';

export class ClientResponseDto {
  @ApiProperty({
    description: 'The unique identifier of the client',
    example: '123e4567-e89b-12d3-a456-426614174000',
  })
  id: string;

  @ApiProperty({
    description: 'The first name of the client',
    example: 'John',
  })
  firstName: string;

  @ApiProperty({
    description: 'The last name of the client',
    example: 'Doe',
  })
  lastName: string;

  @ApiProperty({
    description: 'The email address of the client',
    example: 'john.doe@example.com',
  })
  email: string;

  @ApiProperty({
    enum: PlanType,
    enumName: 'PlanType',
    description: 'The subscription plan of the client',
    example: PlanType.PREMIUM,
  })
  plan: PlanType;

  @ApiProperty({
    description: 'Maximum number of users allowed for this client',
    example: 10,
  })
  maxUsers: number;

  @ApiProperty({
    type: [UserResponseDto],
    description: 'List of users associated with this client',
  })
  linkedUsers?: UserResponseDto[];

  @ApiProperty({
    type: [RoleResponseDto],
    description: 'List of roles defined for this client',
  })
  roles?: RoleResponseDto[];

  @ApiProperty({
    description: 'Date when the client was created',
    example: '2023-01-01T00:00:00.000Z',
  })
  createdAt: Date;

  @ApiProperty({
    description: 'Date when the client was last updated',
    example: '2023-01-02T00:00:00.000Z',
  })
  updatedAt: Date;

  constructor(partial: Partial<ClientResponseDto>) {
    Object.assign(this, partial);
  }
}
