<?php

namespace Kylin\Activity\Contracts;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Support\Collection;

/**
 * 活动日志模型接口
 *
 * 定义活动日志模型必须实现的方法。
 * 实现类需提供 subject/causer 多态关联、额外属性获取等功能。
 */
interface Activity
{
    public function subject(): MorphTo;

    public function causer(): MorphTo;

    public function getExtraProperty(string $propertyName, mixed $defaultValue): mixed;

    public function changes(): Collection;

    public function scopeInLog(Builder $query, ...$logNames): Builder;

    public function scopeCausedBy(Builder $query, Model $causer): Builder;

    public function scopeForEvent(Builder $query, string $event): Builder;

    public function scopeForSubject(Builder $query, Model $subject): Builder;

    public function scopeForBatch(Builder $query, string $batchUuid): Builder;

    public function scopeHasBatch(Builder $query): Builder;

    public function scopeForTenant(Builder $query, ?int $tenantId = null): Builder;
}
