···11+<?php
22+33+namespace SocialDept\AtpParity\Events;
44+55+use Illuminate\Database\Eloquent\Model;
66+use Illuminate\Foundation\Events\Dispatchable;
77+use SocialDept\AtpParity\Sync\PendingConflict;
88+use SocialDept\AtpSchema\Data\Data;
99+1010+/**
1111+ * Dispatched when a conflict is detected that requires manual resolution.
1212+ */
1313+class ConflictDetected
1414+{
1515+ use Dispatchable;
1616+1717+ public function __construct(
1818+ public readonly Model $model,
1919+ public readonly Data $record,
2020+ public readonly array $meta,
2121+ public readonly PendingConflict $conflict,
2222+ ) {}
2323+}
+15
src/Events/ImportCompleted.php
···11+<?php
22+33+namespace SocialDept\AtpParity\Events;
44+55+use Illuminate\Foundation\Events\Dispatchable;
66+use SocialDept\AtpParity\Import\ImportResult;
77+88+class ImportCompleted
99+{
1010+ use Dispatchable;
1111+1212+ public function __construct(
1313+ public readonly ImportResult $result,
1414+ ) {}
1515+}
+16
src/Events/ImportFailed.php
···11+<?php
22+33+namespace SocialDept\AtpParity\Events;
44+55+use Illuminate\Foundation\Events\Dispatchable;
66+77+class ImportFailed
88+{
99+ use Dispatchable;
1010+1111+ public function __construct(
1212+ public readonly string $did,
1313+ public readonly string $collection,
1414+ public readonly string $error,
1515+ ) {}
1616+}
+17
src/Events/ImportProgress.php
···11+<?php
22+33+namespace SocialDept\AtpParity\Events;
44+55+use Illuminate\Foundation\Events\Dispatchable;
66+77+class ImportProgress
88+{
99+ use Dispatchable;
1010+1111+ public function __construct(
1212+ public readonly string $did,
1313+ public readonly string $collection,
1414+ public readonly int $recordsSynced,
1515+ public readonly ?string $cursor = null,
1616+ ) {}
1717+}
+15
src/Events/ImportStarted.php
···11+<?php
22+33+namespace SocialDept\AtpParity\Events;
44+55+use Illuminate\Foundation\Events\Dispatchable;
66+77+class ImportStarted
88+{
99+ use Dispatchable;
1010+1111+ public function __construct(
1212+ public readonly string $did,
1313+ public readonly string $collection,
1414+ ) {}
1515+}
+20
src/Events/RecordPublished.php
···11+<?php
22+33+namespace SocialDept\AtpParity\Events;
44+55+use Illuminate\Database\Eloquent\Model;
66+use Illuminate\Foundation\Events\Dispatchable;
77+88+/**
99+ * Dispatched when a model is published to AT Protocol.
1010+ */
1111+class RecordPublished
1212+{
1313+ use Dispatchable;
1414+1515+ public function __construct(
1616+ public readonly Model $model,
1717+ public readonly string $uri,
1818+ public readonly string $cid,
1919+ ) {}
2020+}
+19
src/Events/RecordUnpublished.php
···11+<?php
22+33+namespace SocialDept\AtpParity\Events;
44+55+use Illuminate\Database\Eloquent\Model;
66+use Illuminate\Foundation\Events\Dispatchable;
77+88+/**
99+ * Dispatched when a model is unpublished from AT Protocol.
1010+ */
1111+class RecordUnpublished
1212+{
1313+ use Dispatchable;
1414+1515+ public function __construct(
1616+ public readonly Model $model,
1717+ public readonly string $uri,
1818+ ) {}
1919+}
+57
src/Jobs/ImportUserJob.php
···11+<?php
22+33+namespace SocialDept\AtpParity\Jobs;
44+55+use Illuminate\Bus\Queueable;
66+use Illuminate\Contracts\Queue\ShouldQueue;
77+use Illuminate\Foundation\Bus\Dispatchable;
88+use Illuminate\Queue\InteractsWithQueue;
99+use Illuminate\Queue\SerializesModels;
1010+use SocialDept\AtpParity\Import\ImportService;
1111+1212+class ImportUserJob implements ShouldQueue
1313+{
1414+ use Dispatchable;
1515+ use InteractsWithQueue;
1616+ use Queueable;
1717+ use SerializesModels;
1818+1919+ /**
2020+ * The number of times the job may be attempted.
2121+ */
2222+ public int $tries = 3;
2323+2424+ /**
2525+ * The number of seconds to wait before retrying.
2626+ */
2727+ public int $backoff = 60;
2828+2929+ public function __construct(
3030+ public string $did,
3131+ public ?string $collection = null,
3232+ ) {
3333+ $this->onQueue(config('parity.import.queue', 'default'));
3434+ }
3535+3636+ public function handle(ImportService $service): void
3737+ {
3838+ $collections = $this->collection ? [$this->collection] : null;
3939+ $service->importUser($this->did, $collections);
4040+ }
4141+4242+ /**
4343+ * Get the tags that should be assigned to the job.
4444+ *
4545+ * @return array<string>
4646+ */
4747+ public function tags(): array
4848+ {
4949+ $tags = ['parity-import', "did:{$this->did}"];
5050+5151+ if ($this->collection) {
5252+ $tags[] = "collection:{$this->collection}";
5353+ }
5454+5555+ return $tags;
5656+ }
5757+}