'array', 'quotation_result' => 'array', 'options' => 'array', 'total_dev_cost' => 'decimal:0', 'total_monthly_fee' => 'decimal:0', ]; public const STATUS_PENDING = 'pending'; public const STATUS_PROCESSING = 'processing'; public const STATUS_COMPLETED = 'completed'; public const STATUS_FAILED = 'failed'; public static function getStatuses(): array { return [ self::STATUS_PENDING => '대기', self::STATUS_PROCESSING => '분석중', self::STATUS_COMPLETED => '완료', self::STATUS_FAILED => '실패', ]; } public function getStatusLabelAttribute(): string { return match ($this->status) { self::STATUS_PENDING => '대기', self::STATUS_PROCESSING => '분석중', self::STATUS_COMPLETED => '완료', self::STATUS_FAILED => '실패', default => $this->status, }; } public function getStatusColorAttribute(): string { return match ($this->status) { self::STATUS_PENDING => 'badge-warning', self::STATUS_PROCESSING => 'badge-info', self::STATUS_COMPLETED => 'badge-success', self::STATUS_FAILED => 'badge-error', default => 'badge-ghost', }; } public function isCompleted(): bool { return $this->status === self::STATUS_COMPLETED; } public function isProcessing(): bool { return $this->status === self::STATUS_PROCESSING; } // Relations public function items(): HasMany { return $this->hasMany(AiQuotationItem::class, 'ai_quotation_id')->orderBy('sort_order'); } public function creator(): BelongsTo { return $this->belongsTo(User::class, 'created_by'); } // Helpers public function getOption(string $key, $default = null) { return data_get($this->options, $key, $default); } public function setOption(string $key, $value): void { $options = $this->options ?? []; data_set($options, $key, $value); $this->options = $options; $this->save(); } public function getFormattedDevCostAttribute(): string { return number_format((int) $this->total_dev_cost).'원'; } public function getFormattedMonthlyFeeAttribute(): string { return number_format((int) $this->total_monthly_fee).'원'; } }