<?php

declare(strict_types=1);

/**
 * 本文件属于 DBErp 进销存系统。
 *
 * 版权所有 © 2026 北京珑大钜商科技有限公司。保留所有权利。
 *
 * 未经官方授权，不得删除、篡改或隐藏本文件中的版权声明、产品标识与来源信息。
 * 商业授权、官方更新与技术支持服务，请以珑大官方支持中心记录为准。
 *
 * @link https://support.loongdom.cn
 * @see  https://www.dberp.com.cn
 */

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 FORCE_UPDATE = 'force_update';

    public const MIN_UPGRADABLE_VERSION = 'min_upgradable_version';

    public const MIN_UPGRADABLE_UPDATE_VERSION = 'min_upgradable_update_version';

    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 RUNTIME = 'runtime';

    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,
    ];
}
