<?php

declare(strict_types=1);

namespace App\Services\SupportCenter;

/**
 * DBErp Phase 1 更新包 manifest.json 契约字段。
 */
final class HostSystemUpdateManifestContract
{
    public const PRODUCT_CODE = 'product_code';

    public const FROM_VERSION = 'from_version';

    public const FROM_UPDATE_VERSION = 'from_update_version';

    public const TO_VERSION = 'to_version';

    public const TO_UPDATE_VERSION = 'to_update_version';

    public const PACKAGE_TYPE = 'package_type';

    public const RELEASE_CHANNEL = 'release_channel';

    public const REQUIRES = 'requires';

    public const FILES = 'files';

    public const DELETE_FILES = 'delete_files';

    public const PROTECTED_PATHS = 'protected_paths';

    public const MIGRATIONS = 'migrations';

    public const COMMANDS = 'commands';

    public const CHECKSUMS = 'checksums';

    public const BACKUP_REQUIRED = 'backup_required';

    public const MAINTENANCE_MODE_REQUIRED = 'maintenance_mode_required';

    public const ROLLBACK_STRATEGY = 'rollback_strategy';

    public const VENDOR = 'vendor';

    public const NOTES = 'notes';

    public const MANIFEST_ENTRY = 'manifest.json';

    public const INSTALL_PACKAGE_TYPE_FULL = 'full';

    /**
     * @var list<string>
     */
    public const ALLOWED_PACKAGE_TYPES = [self::INSTALL_PACKAGE_TYPE_FULL];

    /**
     * @var list<string>
     */
    public const REQUIRED_FIELDS = [
        self::PRODUCT_CODE,
        self::TO_UPDATE_VERSION,
        self::PACKAGE_TYPE,
        self::FILES,
        self::CHECKSUMS,
        self::BACKUP_REQUIRED,
    ];

    /**
     * 选填元数据（发布构建基线、审计；不参与安装门禁）。
     *
     * @var list<string>
     */
    public const OPTIONAL_METADATA_FIELDS = [
        self::FROM_VERSION,
        self::FROM_UPDATE_VERSION,
    ];
}
