<?php

namespace App\Http\Controllers\Wechat\OfficialAccount\Transformers;

class OfficialAccountTransformer
{
    public function transform($officialAccount){
        return [
            'id'       =>  isset($officialAccount->id) ? $officialAccount->id : "",
            'name'       =>  isset($officialAccount->name) ? $officialAccount->name : "",
            'nickname'       =>  isset($officialAccount->nickname) ? $officialAccount->nickname : "",
            'alias'       =>  isset($officialAccount->alias) ? $officialAccount->alias : "",
            'head_img'       =>  isset($officialAccount->head_img) ? $officialAccount->head_img : "",
            'appid'   =>  isset($officialAccount->appid) ? $officialAccount->appid : "",
            'appsecret'   => isset($officialAccount->appsecret) ? $officialAccount->appsecret : "",
            'verify_txt' => isset($officialAccount->verify_txt) ? $officialAccount->verify_txt : "",
            'is_auth' => isset($officialAccount->is_auth) ? $officialAccount->is_auth : 1,
            'service_type_info' => isset($officialAccount->service_type_info) ? $officialAccount->service_type_info : "",
            'subscribe_top_num' => isset($officialAccount->subscribe_top_num) ? $officialAccount->subscribe_top_num : 0,
            'subscribe_day_maximum' => isset($officialAccount->subscribe_day_maximum) ? $officialAccount->subscribe_day_maximum : 0,
            'distribution_channel_id' => isset($officialAccount->distribution_channel_id) ? $officialAccount->distribution_channel_id : "",
            'qrcode_url' => isset($officialAccount->qrcode_url) ? $officialAccount->qrcode_url : "",
            'principal_name' => isset($officialAccount->principal_name) ? $officialAccount->principal_name : "",
            'func_info' => isset($officialAccount->func_info) ? $officialAccount->func_info : "",
            'authorizer_refresh_token' => isset($officialAccount->authorizer_refresh_token) ? $officialAccount->authorizer_refresh_token : "",
            'cancel_auth_time' => isset($officialAccount->cancel_auth_time) ? $officialAccount->cancel_auth_time : "",
            'official_account_type' => isset($officialAccount->official_account_type) ? $officialAccount->official_account_type : "",
            'verify_type_info' => isset($officialAccount->verify_type_info) ? $officialAccount->verify_type_info : "",
            'is_enabled' => isset($officialAccount->is_enabled) ? $officialAccount->is_enabled : 1,
            'todayForceSubscribeUsers' => isset($officialAccount->todayForceSubscribeUsers) ? $officialAccount->todayForceSubscribeUsers : 0,
            'allForceSubscribeUsers' => isset($officialAccount->allForceSubscribeUsers) ? $officialAccount->allForceSubscribeUsers : 0,
        ];
    }
}