from django.db import models
from django.utils import timezone

from fwd_api.models import UserProfile
from fwd_api.models.Subscription import Subscription


class SubscriptionRequest(models.Model):
    id = models.AutoField(primary_key=True)
    pages: int = models.IntegerField()
    doc_type: str = models.CharField(max_length=100)
    request_id = models.CharField(max_length=200)  # Change to request_id
    process_type = models.CharField(max_length=200)  # driver/id/invoice
    provider_code = models.CharField(max_length=200, default="Guest")  # Request source FWD/CTel
    predict_result = models.JSONField(null=True)
    status = models.IntegerField()  # 1: Processing(Pending) 2: PredictCompleted 3: ReturnCompleted
    subscription = models.ForeignKey(Subscription, on_delete=models.CASCADE)
    created_at = models.DateTimeField(default=timezone.now)
    updated_at = models.DateTimeField(auto_now=True)