<?xml version="1.0" encoding="UTF-8"?>

<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'>

    <BUSINESSCLASS  name="Candidate"    package="performa.orm"  superclass="SecUserExtension">
        
        <IMPORT value="oneit.security.*"    />
        
        <MULTIPLEREFERENCE  name="TestAnalysises"           type="TestAnalysis"             backreferenceName="Candidate"   />
        <MULTIPLEREFERENCE  name="JobApplications"          type="JobApplication"           backreferenceName="Candidate"   />
        <MULTIPLEREFERENCE  name="CultureCriteriaAnswers"   type="CultureCriteriaAnswer"    backreferenceName="Candidate"  />
        <MULTIPLEREFERENCE  name="ProfileAssessmentAnswers" type="Answer"                   backreferenceName="Candidate"  />
        
        <TRANSIENT  name="PrivacyPolicyAgreed"  type="Boolean"  defaultValue="Boolean.FALSE"/>
        <TRANSIENT  name="ConditionsAgreed"     type="Boolean"  defaultValue="Boolean.FALSE"/>
        <TRANSIENT  name="HasValidAddress"      type="Boolean"  defaultValue="Boolean.FALSE"/>

        <TABLE  name="oneit_sec_user_extension" tablePrefix="object"    polymorphic="TRUE">

            <ATTRIB name="Phone"                        type="String"   dbcol="phone"                       length="30"/>
            <ATTRIB name="ForgotPasswordMailSendDate"   type="Date"     dbcol="forgot_password_mail_send_date" />
            <ATTRIB name="ForgotPasswordKey"            type="String"   dbcol="forgot_password_key"         length="10"/>
            <ATTRIB name="VerificationMailSendDate"     type="Date"     dbcol="verification_mail_send_date" />
            <ATTRIB name="VerificationKey"              type="String"   dbcol="verification_key"            length="10"/>
            <ATTRIB name="IsAccountVerified"            type="Boolean"  dbcol="is_account_verified"         defaultValue="Boolean.FALSE"/>
            <ATTRIB name="IsPasswordChanged"            type="Boolean"  dbcol="is_password_changed"         defaultValue="Boolean.FALSE"/>
            <ATTRIB name="GoogleAddressText"            type="String"   dbcol="google_address_text"         length="300"/>
            <ATTRIB name="IsEmailIngest"                type="Boolean"  dbcol="is_email_ingest"             defaultValue="Boolean.FALSE"/>
            <ATTRIB name="IsMaskedEmail"                type="Boolean"  dbcol="is_masked_email"             defaultValue="Boolean.FALSE"/>
            <ATTRIB name="KnownAsAlias"                 type="String"   dbcol="known_as_alias"              length="100"/>

            <SINGLEREFERENCE    name="TestInput"    type="TestInput"    dbcol="test_input_id"   backreferenceName="Candidates"  />
            <SINGLEREFERENCE    name="User"         type="SecUser"      dbcol="user_id"         backreferenceName="Extensions"  inSuper='TRUE'/>
        </TABLE>
        
        <SEARCH type="All"      paramFilter="oneit_sec_user_extension.object_id is not null"    >
        </SEARCH>
        
        <SEARCH type="Alias" filter="known_as_alias = ?" polymorphic="TRUE" singleton="TRUE">
            <PARAM name="KnownAs" type="String"/>
        </SEARCH>
        
        <SEARCH type="IdPin"    paramFilter="oneit_sec_user_extension.object_id is not null"   singleton="TRUE">
            <PARAM name="ID"    type="Long"     paramFilter="object_id = ${ID} " />
            <PARAM name="Pin"   type="String"   paramFilter="verification_key = ${Pin}" />
        </SEARCH>
        
    </BUSINESSCLASS>
    
</ROOT>