import { Component } from 'vue';

// Rest settings
type RestSettingsType = {
    endpoints: {
        settings: string;
        posts: string;
        boostsite: string;
    };
    nonce: string;
};

// Advanced schedule
type AdvancedScheduleType = {
    '1': string[]; // Monday
    '2': string[];
    '3': string[];
    '4': string[];
    '5': string[];
    '6': string[];
    '0': string[];
} | null;

// Schedule
type ScheduleType = {
    id: string;
    topic: string;
    amount: string;
    days: string[];
    time: string;
    time_zone: string;
    author: string;
    lang: string;
    advSchedule: AdvancedScheduleType;
    articles_keywords: string[][][];
    activity_date_enabled: boolean;
    activity_date?: string[];
};

// App settings
type AppSettingsType = {
    user_id: string;
    email: string;
    schedules: ScheduleType[];
    language: string;
    rest_url: string;
    account_type: 'FREE' | 'SEO_PLUGIN_PLAN';
    available_tokens: number;
    used_tokens: number;
    trial_end_time: string;
    available_tokens_additional: number;
    has_plugin: string;
    account_expired: string;
    enable_category_creation: boolean;
    category_creation_limit: number;
};

// Global app config
type AppConfigType = {
    rest: RestSettingsType;
    nonce: string;
    settings: AppSettingsType;
    prefix: string;
    admin_url: string;
    home_url: string;
    plugin_url: string;
    is_logged_in: boolean;
    is_api_key_missing: boolean;
    wordpress: {
        users: string[];
        keywords: string[];
        timezone: string;
    };
};

// Subscription details type
type SubscriptionDetailsType = {
    lastPayment: string;
    nextPayment: string;
    price: number;
    status: 'active' | 'past_due' | 'unpaid' | 'canceled' | 'incomplete' | 'incomplete_expired' | 'trialing';
    planInterval: string;
    planType: string;
};

// Option for checkbox/radio
type OptionType = {
    label: string;
    value: string;
    disabled?: boolean;
};

// Option for dropdown
type DropdownOptionType = {
    label: string;
    value?: string;
    selected: boolean;
    icon?: Component;
    disabled?: boolean;
};

// Step for steps
type StepType = {
    label: string;
    description?: string;
    callback?: () => void;
};

type PostStatusType = 'published' | 'schedule_generate' | 'schedule_publish';

// Post type for WP posts
type PostType = {
    id: string;
    title: string;
    publish_date: string;
    status: PostStatusType;
    post_link: string;
    keywords?: string[];
    dayIndex?: number;
    timeIndex?: number;
};

// Filters
type FiltersType = {
    search: string;
    status: string[];
    keywords: string[];
};

// Tabs
type TabType = {
    label: string;
    content: Component;
};

// Messages
type MessageType = {
    message: string;
    link?: {
      label: string;
      url: string;
    };
    type?: string;
    show_icon?: boolean;
    size?: string;
};

export type {
    OptionType,
    StepType,
    AppConfigType,
    AppSettingsType,
    ScheduleType,
    PostType,
    PostStatusType,
    DropdownOptionType,
    FiltersType,
    TabType,
    MessageType,
    AdvancedScheduleType,
    SubscriptionDetailsType,
};
