import {

    IsInt,

    IsNotEmpty,

    IsOptional,
    IsString
} from "class-validator";
import { StatsClient } from '../entities/StatsClient';

/**
 * Defines the statsClient response.
*/
export class ResponseStatsClient {
    /**
     * The client's id.
     */
    @IsInt()
    id: number;

    /**
     * The client's description.
     */
    @IsString()
    @IsOptional()
    description?: string;

    /**
     * The client's api key.
     * Only visible on creation or regeneration.
     */
    @IsString()
    @IsOptional()
    key: string;

    /**
     * The client's api key prefix.
     */
    @IsString()
    @IsNotEmpty()
    prefix: string;

    /**
     * Creates a ResponseStatsClient object from a statsClient.
     * @param client The statsClient the response shall be build for.
     */
    public constructor(client: StatsClient) {
        this.id = client.id;
        this.description = client.description;
        this.prefix = client.prefix;
        this.key = "Only visible on creation.";
    }
}
