<?php
namespace App\Models\Entities;

use CodeIgniter\Model;
class VrfcReqModel extends Model {
    // Model implementation here
    protected $table = 'v2_vrfc_req';
    protected $primaryKey = 'vr_sq';
    protected $useAutoIncrement = true;
    protected $returnType     = 'array';

    protected $allowedFields = [
        'reqSeq',
        'atcl_no',
        'step',
        'cpid',
        'cp_atcl_id',
        'trade_type',
        'realtor_nm',
        'realtor_tel_no',
        'seller_tel_no',
        'vrfc_type',
        'rgbk_confirm',
        'req_type',
        'rdate',
        'cpTelNo',
        'stat_cd',
        'try_cnt',
        'insert_user',
        'insert_tm',
        'memo',
        'contact_fail_cnt',
        'sync_yn',
        'reg_try_cnt',
        'tel_fail_cause',
        'rgbk_confirm_owner_nm',
        'direct_trad_yn',
        'confirm_doc_img_url',
        'confirm_doc_owner_check_yn',
        'owner_verifiable',
        'vrfc_cmpl_type',
        'rgbk_doc_img_url',
        'certRegister',
        'referenceFileUrl'
    ];

    


    // public function insertV2Article(array $articleInfo): bool
    // {
    //     // Insert data into the database
    //     // This is a placeholder implementation

        


    //         $articleNumber = $articleInfo['articleNumber']; // 매물 번호와 동일
    //         $cpId = $articleInfo['cpId'];          // CPID
    //         $cpArticleNumber = $articleInfo['cpArticleNumber'];  // CP 매물번호

    //         $rcpt_product		= $articleInfo['realEstateTypeCode'];		// 매물종류(코드)
    //         $rcpt_product_nm	= $articleInfo['realEstateType'];		// 매물종류(한글명) // 아파트... ......

    //         $rcpt_deal_type		= $articleInfo['tradeTypeCode'];	// 거래구분(코드)   A1, B1, B2
    //         $rcpt_product_info1	= $articleInfo['tradeType'];		// 거래구분(한글명) 매매, 전세, 월세

    //         $statusTypeCode = $articleInfo['statusTypeCode']; // E12 ...매물 상태 코드 

    //         $vrfc_type_code	= $articleInfo['verificationTypeCode'];	// 확인유형코드 S, D, N, M, T, O
    //         $owenrTypeCode = $articleInfo['ownerTypeCode'] ?? ''; // 소유자 유형 코드
    //         $isUnregisteredVerificationRequested = $articleInfo['isUnregisteredVerificationRequested'] ?? false; // 미등기 확인요청 여부
    //         $isBuildingRegisterAreaCheckRequested = $articleInfo['isBuildingRegisterAreaCheckRequested'] ?? false; // 건축물대장 면적확인 요청 여부
    //         $isAutoVerificationRequested = $articleInfo['isAutoVerificationRequested'] ?? false; // 자동확인 요청 여부
    //         // $verificationReference = $articleInfo['verificationReference'] ?? ''; // 확인참고사항 
    //         $exposureStartDateTime = $articleInfo['exposureStartDateTime'] ?? ''; // 노출시작일시

    //         $facilities['roomCount'] = $articleInfo['facilities']['roomCount'] ?? 0;
    //         $facilities['bathroomCount'] = $articleInfo['facilities']['bathroomCount'] ?? 0;

    //         $address['legalDivision']['cityNumber'] = $articleInfo['address']['legalDivision']['cityNumber'] ?? '';
    //         $address['legalDivision']['divisionNumber'] = $articleInfo['address']['legalDivision']['divisionNumber'] ?? '';
    //         $address['legalDivision']['sectorNumber'] = $articleInfo['address']['legalDivision']['sectorNumber'] ?? '';
    //         $address['legalDivision']['legalDivisionAddress'] = $articleInfo['address']['legalDivision']['legalDivisionAddress'] ?? '';
    //         $address['complexNumber'] = $articleInfo['address']['complexNumber'] ?? null;
    //         $address['complexName'] = $articleInfo['address']['complexName'] ?? null;
    //         $address['pyeongTypeNumber'] = $articleInfo['address']['pyeongTypeNumber'] ?? null;
    //         $address['hoName'] = $articleInfo['address']['hoName'] ?? null;

    //         $address['isVirtualAddress'] = $articleInfo['address']['isVirtualAddress'] ?? false;
    //         $address['correspondenceFloorCount'] = $articleInfo['address']['correspondenceFloorCount'] ?? 0;
    //         $address['longitude'] = $articleInfo['address']['longitude'] ?? 0;
    //         $address['latitude'] = $articleInfo['address']['latitude'] ?? 0;
    //         $address['isDongHoChecked'] = $articleInfo['address']['isDongHoChecked'] ?? null;
    //         $address['inquiryLevel'] = $articleInfo['address']['inquiryLevel'] ?? null;

    //         $space['totalSpace'] = $articleInfo['space']['totalSpace'] ?? null;
    //         $space['groundSpace'] = $articleInfo['space']['groundSpace'] ?? null;
    //         $space['buildingSpace'] = $articleInfo['space']['buildingSpace'] ?? null;
    //         $space['supplySpace'] = $articleInfo['space']['supplySpace'] ?? 0;
    //         $space['exclusiveSpace'] = $articleInfo['space']['exclusiveSpace'] ?? 0;

    //         $price['dealAmount'] = $articleInfo['price']['dealAmount'] ?? 0;
    //         $price['warrantyAmount'] = $articleInfo['price']['warrantyAmount'] ?? 0;
    //         $price['leaseAmount'] = $articleInfo['price']['leaseAmount'] ?? 0;

    //         $floor['correspondenceFloorCount'] = $articleInfo['floor']['correspondenceFloorCount'] ?? 0;
    //         $floor['correspondenceFloorType'] = $articleInfo['floor']['correspondenceFloorType'] ?? null;
    //         $floor['totalFloorCount'] = $articleInfo['floor']['totalFloorCount'] ?? 0;
    //         $floor['undergroundFloorCount'] = $articleInfo['floor']['undergroundFloorCount'] ?? 0;

    //         $seller['sellerTelephoneNumber'] = $articleInfo['seller']['sellerTelephoneNumber'] ?? null;
    //         $seller['sellerName'] = $articleInfo['seller']['sellerName'] ?? null;
    //         $seller['ownerTelephoneNumber'] = $articleInfo['seller']['ownerTelephoneNumber'] ?? null;
    //         $seller['ownerName'] = $articleInfo['seller']['ownerName'] ?? null;
    //         $seller['isOwnerCertificationAgree'] = $articleInfo['seller']['isOwnerCertificationAgree'] ?? null;
    //         $seller['isDirectTrade'] = $articleInfo['seller']['isDirectTrade'] ?? null;

    //         $realtor['realtorName'] = $articleInfo['realtor']['realtorName'] ?? null;
    //         $realtor['representativeCellphoneNumber'] = $articleInfo['realtor']['representativeCellphoneNumber'] ?? null;
    //         $realtor['representativeTelephoneNumber'] = $articleInfo['realtor']['representativeTelephoneNumber'] ?? null;

    //         $files = $articleInfo['files'] ?? [];




    //     return true;
    // }
}