from .base_task import BaseTask

class SportMathTask(BaseTask):
    
    def get_task_content(self, item):
        """
        Fetches 'math_question' and 'sport_text', formats them, 
        and returns the standard content dictionary.
        """
        # 1. Fetch task-specific data
        math_text = item['math_question']
        sport_text = item['sport_text'][:-1] if item['sport_text'].endswith('.') else item['sport_text']
        prompt_key = self.config['prompt_template']
        
        # 2. Get templates
        text_template = self.prompt_templates[prompt_key]['text_prompt']
        inst_template = self.prompt_templates[prompt_key]['instruction_prompt']

        # 3. Format chunks (this replaces self.text_prompt, etc.)
        text_chunk = text_template.replace("[[math_text_fill]]", f"{math_text}").replace("[[sport_text_fill]]", f"{sport_text}").replace(".\n", "\n")
        inst_chunk = inst_template # Assuming no fill-in for instruction

        # 4. Create full prompt
        full_prompt_text = text_chunk + inst_chunk
        
        # 5. Return the standardized dictionary
        return {
            "full_prompt": full_prompt_text,
            "has_image": False, # Your original 'conv' did not have an image placeholder
            "chunks_for_attention": {
                'sport_text': " 'Sport': " + sport_text,
                'math_text': " 'Math': " + math_text,
                'text': text_chunk,
                'instruction': inst_chunk
            }
        }