<?php

namespace app\model;

use think\Model;

class CampaignBudget extends Model
{
    // 设置当前模型对应的完整数据表名称
    protected $table = 'bps.bps_google_ads_budget';

    // 设置主键
    protected $pk = 'budget_id';

    // 设置自动时间戳
    protected $autoWriteTimestamp = true;

    // 定义时间戳字段
    protected $createTime = 'create_at';
    protected $updateTime = 'update_at';

    // 设置字段类型和默认值
    protected $casts = [
        'budget_id' => 'int',
        'customer_id' => 'int',
        'amount_micros' => 'int',
        'start_date' => 'date',
        'end_date' => 'date',
    ];

    // 默认值设置
    protected $defaults = [
        'amount_micros' => 0, // 预算金额默认0
    ];

    // 关联 Customer 模型(预算与客户相关)
//    public function customer()
//    {
//        return $this->belongsTo(GoogleAdsCustomer::class, 'customer_id', 'customer_id');
//    }

    // 可以根据需要添加其他关联方法,假设有其他与预算相关的表,例如广告系列(campaign)
}