import { Resource } from "../resource"; import { StoreProfile, APIProfile, Gender, Ethnicity } from "./interfaces"; import { Response } from "src/server"; export declare class Profile extends Resource { /** * The id of the user who owns the profile */ userId: string; /** * The profile's name. */ name: string; /** * The profile's sex. */ sex: Gender | null; /** * The profile's birth year. */ birthYear: number | null; /** * The profile's ethnicity. */ ethnicity: Ethnicity | null; /** * The profile's dnaSampleId. */ dnaSampleId?: string; /** * Holds if the profile is version 2. */ isV2?: boolean; /** * A computed property, which tells if any of the sex, * birthYear or ethnicity fields is null */ get hasDataMissing(): boolean; /** * * @param user_id * @param name * @param sex * @param birth_year * @param ethnicity * @param has_missing_data * @param dna_sample_id * @param isV2 */ constructor(user_id: string, name: string, sex: Gender | null, birth_year: number | null, ethnicity: Ethnicity | null, dna_sample_id?: string, isV2?: boolean); /** * The name of the Profile resource on the API server. */ static get resourceName(): string; /** * The name of the service containing the profile resource. */ static get serviceName(): string; /** * Returns true if, in a StoreProfile object, any of * the sex, birthYear or ethnicity properties is null. * * Returns false otherwise */ static hasDataMissing(storeProfile: StoreProfile): boolean; /** * Convert the profile into a JSON serializable object for the API server. */ serializeAPI(): APIProfile; /** * Deserialize the data from the API server. * * @param data The profile data from the API server. */ deserializeAPI(data: APIProfile): void; /** * Serialize the profile into a format for storing in the Redux store. */ serializeRedux(): StoreProfile; /** * Handle any http errors. * * @param response The response. * * @returns `null`. */ protected static handleError(response: Response): null; /** * Create a profile from the API server data. * * @param data Data from the api server. * * @returns The profile object. */ static apiFactory(data: APIProfile): Profile; /** * Create a profile from the Redux store data. * * @param data Data from the api server. * * @returns The profile object. */ static reduxFactory(data: StoreProfile): Profile; }