<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class PowerDnsRecordMetadata extends Model
{
    use HasFactory;

    protected $table = 'powerdns_record_metadata';

    protected $fillable = [
        'zone_name',
        'record_name',
        'record_type',
        'notes',
    ];

    /**
     * Obține sau creează metadata pentru o înregistrare PowerDNS
     */
    public static function getOrCreate($zoneName, $recordName, $recordType)
    {
        return self::firstOrCreate([
            'zone_name' => $zoneName,
            'record_name' => $recordName,
            'record_type' => $recordType,
        ]);
    }
}
