from tortoise.models import Model
from tortoise import fields


class Job(Model):
    id = fields.CharField(max_length=255, pk=True)
    title = fields.CharField(max_length=1024)
    description = fields.TextField()
    category = fields.CharField(max_length=1024)
    total_applicants = fields.IntField(null=True)
    preferred_freelancer_location = fields.CharField(max_length=1024, null=True)
    preferred_freelancer_location_mandatory = fields.BooleanField(null=True)
    premium = fields.BooleanField(null=True)
    experience_level = fields.CharField(max_length=50, null=True)
    amount_raw_value = fields.CharField(max_length=1024, null=True)
    amount_currency = fields.CharField(max_length=10, null=True)
    skills = fields.JSONField(null=True)  # type: ignore
    hourly_budget_type = fields.CharField(max_length=50, null=True)
    hourly_budget_min = fields.FloatField(null=True)
    hourly_budget_max = fields.FloatField(null=True)
    duration = fields.CharField(max_length=50, null=True)
    client_not_sure_fields = fields.TextField(null=True)
    client_private_fields = fields.TextField(null=True)
    freelancer_client_relation = fields.TextField(null=True)
    local_job_user_distance = fields.TextField(null=True)
    weekly_budget_raw_value = fields.CharField(max_length=1024, null=True)
    weekly_budget_currency = fields.CharField(max_length=10, null=True)
    weekly_budget_display_value = fields.CharField(max_length=1024, null=True)
    engagement_duration_id = fields.CharField(max_length=1024, null=True)
    engagement_duration_label = fields.CharField(max_length=1024, null=True)
    engagement_duration_weeks = fields.IntField(null=True)
    client_edc_user_id = fields.CharField(max_length=1024, null=True)
    client_total_hires = fields.IntField(null=True)
    client_total_posted_jobs = fields.IntField(null=True)
    client_total_spent = fields.FloatField(null=True)
    client_location_city = fields.CharField(max_length=1024, null=True)
    client_location_country = fields.CharField(max_length=100, null=True)
    client_location_timezone = fields.CharField(max_length=100, null=True)
    client_location_state = fields.CharField(max_length=100, null=True)
    client_location_offset_to_utc = fields.CharField(max_length=50, null=True)
    client_total_reviews = fields.IntField(null=True)
    client_total_feedback = fields.FloatField(null=True)
    client_company_rid = fields.CharField(max_length=1024, null=True)
    client_company_name = fields.CharField(max_length=1024, null=True)
    client_last_contract_platform = fields.CharField(max_length=1024, null=True)
    client_last_contract_rid = fields.CharField(max_length=1024, null=True)
    client_last_contract_title = fields.CharField(max_length=1024, null=True)
    client_has_financial_privacy = fields.BooleanField(null=True)
    occupations_category_id = fields.CharField(max_length=1024, null=True)
    occupations_category_pref_label = fields.CharField(max_length=1024, null=True)
    created_date_time = fields.DatetimeField()
    published_date_time = fields.DatetimeField()

    def __str__(self):
        return f"Job(id='{self.id}', title='{self.title}')"
