""" Options:
Date: 2025-01-06 02:36:53
Version: 8.51
Tip: To override a DTO option, remove "#" prefix before updating
BaseUrl: https://blazor-gallery.servicestack.net

#GlobalNamespace: 
#AddServiceStackTypes: True
#AddResponseStatus: False
#AddImplicitVersion: 
#AddDescriptionAsComments: True
IncludeTypes: CreateJobApplication.*
#ExcludeTypes: 
#DefaultImports: datetime,decimal,marshmallow.fields:*,servicestack:*,typing:*,dataclasses:dataclass/field,dataclasses_json:dataclass_json/LetterCase/Undefined/config,enum:Enum/IntEnum
#DataClass: 
#DataClassJson: 
"""

import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class JobApplicationAttachment:
    id: int = 0
    # @References(typeof(JobApplication))
    job_application_id: int = 0

    file_name: Optional[str] = None
    file_path: Optional[str] = None
    content_type: Optional[str] = None
    content_length: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AppUser:
    id: Optional[str] = None
    first_name: Optional[str] = None
    last_name: Optional[str] = None
    display_name: Optional[str] = None
    profile_url: Optional[str] = None


class EmploymentType(str, Enum):
    FULL_TIME = 'FullTime'
    PART_TIME = 'PartTime'
    CASUAL = 'Casual'
    CONTRACT = 'Contract'


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Job(AuditBase):
    id: int = 0
    title: Optional[str] = None
    employment_type: Optional[EmploymentType] = None
    company: Optional[str] = None
    location: Optional[str] = None
    salary_range_lower: int = 0
    salary_range_upper: int = 0
    description: Optional[str] = None
    applications: List[JobApplication] = field(default_factory=list)
    closing: datetime.datetime = datetime.datetime(1, 1, 1)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Contact:
    id: int = 0
    # @Computed()
    display_name: Optional[str] = None

    profile_url: Optional[str] = None
    first_name: Optional[str] = None
    last_name: Optional[str] = None
    salary_expectation: Optional[int] = None
    job_type: Optional[str] = None
    availability_weeks: int = 0
    preferred_work_type: Optional[EmploymentType] = None
    preferred_location: Optional[str] = None
    email: Optional[str] = None
    phone: Optional[str] = None
    skills: Optional[List[str]] = None
    about: Optional[str] = None
    applications: List[JobApplication] = field(default_factory=list)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class JobApplicationComment(AuditBase):
    id: int = 0
    # @References(typeof(AppUser))
    app_user_id: Optional[str] = None

    app_user: Optional[AppUser] = None
    # @References(typeof(JobApplication))
    job_application_id: int = 0

    comment: Optional[str] = None


class JobApplicationStatus(str, Enum):
    APPLIED = 'Applied'
    PHONE_SCREENING = 'PhoneScreening'
    PHONE_SCREENING_COMPLETED = 'PhoneScreeningCompleted'
    INTERVIEW = 'Interview'
    INTERVIEW_COMPLETED = 'InterviewCompleted'
    OFFER = 'Offer'
    DISQUALIFIED = 'Disqualified'


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class JobApplicationEvent(AuditBase):
    id: int = 0
    # @References(typeof(JobApplication))
    job_application_id: int = 0

    # @References(typeof(AppUser))
    app_user_id: Optional[str] = None

    app_user: Optional[AppUser] = None
    description: Optional[str] = None
    status: Optional[JobApplicationStatus] = None
    event_date: datetime.datetime = datetime.datetime(1, 1, 1)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PhoneScreen(AuditBase):
    id: int = 0
    # @References(typeof(AppUser))
    app_user_id: Optional[str] = None

    app_user: Optional[AppUser] = None
    # @References(typeof(JobApplication))
    job_application_id: int = 0

    application_status: Optional[JobApplicationStatus] = None
    notes: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Interview(AuditBase):
    id: int = 0
    booking_time: datetime.datetime = datetime.datetime(1, 1, 1)
    # @References(typeof(JobApplication))
    job_application_id: int = 0

    # @References(typeof(AppUser))
    app_user_id: Optional[str] = None

    app_user: Optional[AppUser] = None
    application_status: Optional[JobApplicationStatus] = None
    notes: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class JobOffer(AuditBase):
    id: int = 0
    salary_offer: int = 0
    currency: Optional[str] = None
    # @References(typeof(JobApplication))
    job_application_id: int = 0

    # @References(typeof(AppUser))
    app_user_id: Optional[str] = None

    app_user: Optional[AppUser] = None
    notes: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class JobApplication:
    id: int = 0
    # @References(typeof(Job))
    job_id: int = 0

    # @References(typeof(Contact))
    contact_id: int = 0

    position: Optional[Job] = None
    applicant: Optional[Contact] = None
    comments: List[JobApplicationComment] = field(default_factory=list)
    applied_date: datetime.datetime = datetime.datetime(1, 1, 1)
    application_status: Optional[JobApplicationStatus] = None
    attachments: List[JobApplicationAttachment] = field(default_factory=list)
    events: List[JobApplicationEvent] = field(default_factory=list)
    phone_screen: Optional[PhoneScreen] = None
    interview: Optional[Interview] = None
    job_offer: Optional[JobOffer] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CreateJobApplication(IReturn[JobApplication], ICreateDb[JobApplication]):
    # @Validate(Validator="GreaterThan(0)")
    job_id: int = 0

    # @Validate(Validator="GreaterThan(0)")
    contact_id: int = 0

    applied_date: datetime.datetime = datetime.datetime(1, 1, 1)
    application_status: Optional[JobApplicationStatus] = None
    attachments: Optional[List[JobApplicationAttachment]] = None