import { FormControl } from '@angular/forms';

import { Profile } from './profile.model';
import { ColumnDefinition, PageLinks, PageMeta } from './shared.model';

export interface Application {
    apikey: string;
    maskedkey: string;
    slug: string;
    title: string;
    description: string;
    author: Profile;
    createdAt: string;
    updatedAt: string;
}

export const applicationColumns: Array<ColumnDefinition> = [
    {
        key: 'titre',
        type: 'text',
        label: 'Titre',
    },
    {
        key: 'maskedkey',
        type: 'text',
        label: 'Clé masquée',
    },
    {
        key: 'createdat',
        type: 'date',
        label: 'Date de création',
    },
    {
        key: 'updatedat',
        type: 'date',
        label: 'Date de mise à jour',
    },
];

export interface ApplicationForm {
    title: FormControl<string>;
    description: FormControl<string>;
}

export interface ApplicationPageData {
    application: Application;
    prevApplication: Application;
    nextApplication: Application;
    _links: PageLinks;
    _meta: PageMeta;
}

export interface ApplicationsPageData {
    applications: Array<Application>;
    count: number;
}
