<?php

namespace Vendtics\App\Models;

defined( "ABSPATH" ) || exit;

use Vendtics\WpMVC\App;
use Vendtics\WpMVC\Database\Resolver;
use Vendtics\WpMVC\Database\Eloquent\Model;
use Vendtics\WpMVC\Database\Eloquent\Relations\BelongsToMany;

class Contact extends Model {
    public static function get_table_name():string {
        return 'vendtics_contacts';
    }

    public function resolver():Resolver {
        return App::$container->get( Resolver::class );
    }

    public function tags():BelongsToMany {
        return $this->belongs_to_many( Tag::class, EntityTag::class, 'tag_id', 'entity_id', 'id', 'id' );
    }

    public function lists():BelongsToMany {
        return $this->belongs_to_many( ListModel::class, EntityList::class, 'list_id', 'entity_id', 'id', 'id' );
    }
}