<?xml version="1.0" encoding="utf-8"?>
<odoo>

    <!-- Cron job to submit pending images for generation -->
    <record id="ir_cron_submit_pending_images" model="ir.cron">
        <field name="name">SEO Content: Submit Pending Images</field>
        <field name="model_id" ref="model_otk_seo_content_image"/>
        <field name="state">code</field>
        <field name="code">model.cron_submit_pending_images()</field>
        <field name="interval_number">1</field>
        <field name="interval_type">minutes</field>
        <field name="active">True</field>
        <field name="priority">10</field>
    </record>

    <!-- Cron job to poll image generation status -->
    <record id="ir_cron_poll_image_status" model="ir.cron">
        <field name="name">SEO Content: Poll Image Status</field>
        <field name="model_id" ref="model_otk_seo_content_image"/>
        <field name="state">code</field>
        <field name="code">model.cron_poll_image_status()</field>
        <field name="interval_number">1</field>
        <field name="interval_type">minutes</field>
        <field name="active">True</field>
        <field name="priority">5</field>
    </record>

    <!-- Cron job to poll content generation status (async) -->
    <record id="ir_cron_poll_content_status" model="ir.cron">
        <field name="name">SEO Content: Poll Content Status</field>
        <field name="model_id" ref="model_otk_seo_content"/>
        <field name="state">code</field>
        <field name="code">model.cron_poll_content_status()</field>
        <field name="interval_number">1</field>
        <field name="interval_type">minutes</field>
        <field name="active">True</field>
        <field name="priority">4</field>
    </record>

    <!-- Cron job to check for stale content and send alerts -->
    <record id="ir_cron_check_stale_content" model="ir.cron">
        <field name="name">SEO Content: Check Stale Content</field>
        <field name="model_id" ref="model_otk_seo_content"/>
        <field name="state">code</field>
        <field name="code">model.cron_check_stale_content()</field>
        <field name="interval_number">1</field>
        <field name="interval_type">days</field>
        <field name="active">True</field>
        <field name="priority">50</field>
        <field name="nextcall" eval="(DateTime.now() + timedelta(days=1)).strftime('%Y-%m-%d 06:00:00')"/>
    </record>

    <!-- Cron job to process batch items asynchronously -->
    <record id="ir_cron_process_batch_items" model="ir.cron">
        <field name="name">SEO Content: Process Batch Items</field>
        <field name="model_id" ref="model_otk_seo_content_batch"/>
        <field name="state">code</field>
        <field name="code">model.cron_process_batch_items()</field>
        <field name="interval_number">1</field>
        <field name="interval_type">minutes</field>
        <field name="active">True</field>
        <field name="priority">15</field>
    </record>

    <!-- Cron job to process scheduled content ideas -->
    <record id="ir_cron_process_scheduled_ideas" model="ir.cron">
        <field name="name">SEO Content: Process Scheduled Ideas</field>
        <field name="model_id" ref="model_otk_seo_content_idea"/>
        <field name="state">code</field>
        <field name="code">model.cron_process_scheduled_ideas()</field>
        <field name="interval_number">30</field>
        <field name="interval_type">minutes</field>
        <field name="active">True</field>
        <field name="priority">20</field>
    </record>

    <!-- Cron job to check generating ideas completion -->
    <record id="ir_cron_check_generating_ideas" model="ir.cron">
        <field name="name">SEO Content: Check Generating Ideas</field>
        <field name="model_id" ref="model_otk_seo_content_idea"/>
        <field name="state">code</field>
        <field name="code">model.cron_check_generating_ideas()</field>
        <field name="interval_number">2</field>
        <field name="interval_type">minutes</field>
        <field name="active">True</field>
        <field name="priority">6</field>
    </record>

</odoo>
