// AUTHORED SHIM (not copied). No-op member extensions to the UnityEngine value/component
// shims, added as the M1 compile loop surfaced specific calls from copied engine/view
// code. Signatures mirror the real UnityEngine API at the call sites (arg counts/types
// taken from the decomp). None executes headless — all return safe defaults.
using System;
using System.Collections.Generic;

namespace UnityEngine
{
    public partial struct Vector4
    {
        public static Vector4 zero => default;
        public static Vector4 one => new Vector4(1f, 1f, 1f, 1f);
        public static Vector4 operator *(Vector4 a, float s) => new Vector4(a.x * s, a.y * s, a.z * s, a.w * s);
        public static Vector4 operator *(float s, Vector4 a) => new Vector4(a.x * s, a.y * s, a.z * s, a.w * s);
        public static Vector4 operator +(Vector4 a, Vector4 b) => new Vector4(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w);
        public static Vector4 operator -(Vector4 a, Vector4 b) => new Vector4(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w);
        public static bool operator ==(Vector4 a, Vector4 b) => a.x == b.x && a.y == b.y && a.z == b.z && a.w == b.w;
        public static bool operator !=(Vector4 a, Vector4 b) => !(a == b);
        public override bool Equals(object o) => o is Vector4 v && this == v;
        public override int GetHashCode() => x.GetHashCode() ^ (y.GetHashCode() << 2) ^ (z.GetHashCode() << 4) ^ (w.GetHashCode() << 6);
        public Vector4(float x, float y, float z) { this.x = x; this.y = y; this.z = z; this.w = 0f; }
        public Vector4(float x, float y) { this.x = x; this.y = y; this.z = 0f; this.w = 0f; }
        // UnityEngine implicitly promotes/truncates between Vector2/3/4.
        public static implicit operator Vector4(Vector3 v) => new Vector4(v.x, v.y, v.z, 0f);
        public static implicit operator Vector3(Vector4 v) => new Vector3(v.x, v.y, v.z);
        public static implicit operator Vector4(Vector2 v) => new Vector4(v.x, v.y, 0f, 0f);
        public static implicit operator Vector2(Vector4 v) => new Vector2(v.x, v.y);
    }

    public partial class Transform
    {
        public bool hasChanged { get; set; }
        public Matrix4x4 localToWorldMatrix => default;
        public Matrix4x4 worldToLocalMatrix => default;
        public void Translate(float x, float y) { }
        public void Rotate(float x, float y) { }
        public void Translate(Vector3 translation, Space relativeTo) { }
        public void Rotate(Vector3 eulers, Space relativeTo) { }
    }

    public partial class LODGroup
    {
        public bool enabled { get; set; }
        public LOD[] GetLODs() => Array.Empty<LOD>();
    }

    public struct LOD
    {
        public float screenRelativeTransitionHeight;
        public Renderer[] renderers;
        public LOD(float height, Renderer[] rends) { screenRelativeTransitionHeight = height; renderers = rends; }
    }

    public partial class Rigidbody
    {
        public bool isKinematic { get; set; }
        public bool useGravity { get; set; }
        public void MovePosition(Vector3 position) { }
        public void MoveRotation(Quaternion rotation) { }
    }

    public partial class Material
    {
        public void CopyPropertiesFromMaterial(Material mat) { }
        public void SetVectorArray(string name, Vector4[] values) { }
        public void SetVectorArray(int nameID, Vector4[] values) { }
        public void SetVectorArray(string name, List<Vector4> values) { }
        public void SetVectorArray(int nameID, List<Vector4> values) { }
    }

    public partial class Mesh
    {
        public int vertexCount => 0;
        public Vector3[] normals { get; set; }
        public Vector4[] tangents { get; set; }
        public Vector2[] uv { get; set; }
        public Color32[] colors32 { get; set; }
        public void MarkDynamic() { }
        public void RecalculateNormals() { }
        public void RecalculateTangents() { }
    }

    public partial class Texture2D
    {
        public byte[] EncodeToPNG() => Array.Empty<byte>();
        public Color32[] GetPixels32() => Array.Empty<Color32>();
        public void SetPixels32(Color32[] colors) { }
        public bool LoadImage(byte[] data) => false;
    }

    public partial class Sprite
    {
        public Rect textureRect => default;
        public Vector2 textureRectOffset => default;
    }

    public partial class Shader
    {
        public static int PropertyToID(string name) => 0;
        public static void SetGlobalColor(string name, Color value) { }
        public static void SetGlobalColor(int nameID, Color value) { }
    }

    public partial class Animation
    {
        public bool enabled { get; set; }
        public bool IsPlaying(string name) => false;
        public void Sample() { }
    }

    public partial class AudioSource
    {
        public float pitch { get; set; }
        public bool playOnAwake { get; set; }
        public int priority { get; set; }
        public void PlayOneShot(AudioClip clip) { }
        public void PlayOneShot(AudioClip clip, float volumeScale) { }
    }

    public partial class Camera
    {
        public bool enabled { get; set; }
        public bool allowMSAA { get; set; }
        public int eventMask { get; set; }
        public TransparencySortMode transparencySortMode { get; set; }
        public void ResetAspect() { }
        public static int GetAllCameras(Camera[] cameras) => 0;
    }

    public enum TransparencySortMode { Default, Perspective, Orthographic, CustomAxis }

    public partial struct CharacterInfo
    {
        public int advance;
        public int minX, maxX, minY, maxY;
        public Vector2 uvBottomLeft, uvBottomRight, uvTopLeft, uvTopRight;
    }

    public partial class Font
    {
        public string[] fontNames { get; set; }
        public Material material { get; set; }
        public static event Action<Font> textureRebuilt;
        public bool GetCharacterInfo(char ch, out CharacterInfo info, int size, FontStyle style)
        { info = default; return false; }
        public bool GetCharacterInfo(char ch, out CharacterInfo info, int size)
        { info = default; return false; }
        public bool GetCharacterInfo(char ch, out CharacterInfo info)
        { info = default; return false; }
        public void RequestCharactersInTexture(string characters, int size, FontStyle style) { }
        public void RequestCharactersInTexture(string characters, int size) { }
        public void RequestCharactersInTexture(string characters) { }
        // suppress unused-event warning while keeping the API surface
        private void _TouchTextureRebuilt() => textureRebuilt?.Invoke(this);
    }

    public partial class Light
    {
        public Color color { get; set; }
    }

    public partial class Time
    {
        public static float smoothDeltaTime => 0f;
    }

    public partial class Application
    {
        public static string streamingAssetsPath => "";
        public static NetworkReachability internetReachability => NetworkReachability.NotReachable;
        public static void OpenURL(string url) { }
    }

    public enum NetworkReachability { NotReachable, ReachableViaCarrierDataNetwork, ReachableViaLocalAreaNetwork }

    public partial class Screen
    {
        public static int sleepTimeout { get; set; }
        public static void SetResolution(int width, int height, bool fullscreen) { }
        public static void SetResolution(int width, int height, FullScreenMode mode) { }
    }

    public enum FullScreenMode { ExclusiveFullScreen, FullScreenWindow, MaximizedWindow, Windowed }

    public enum IMECompositionMode { Auto, On, Off }

    public partial class Input
    {
        public static Vector2 compositionCursorPos { get; set; }
        public static string compositionString => "";
        public static IMECompositionMode imeCompositionMode { get; set; }
    }

    public partial class Resources
    {
        public static Object[] FindObjectsOfTypeAll(Type type) => Array.Empty<Object>();
        public static T[] FindObjectsOfTypeAll<T>() => Array.Empty<T>();
    }
}

namespace UnityEngine.Networking
{
    public partial class UnityWebRequest
    {
        public UnityWebRequest() { }
        public UnityWebRequest(string url, string method) { }
        public static string EscapeURL(string s) => s;
        public static UnityWebRequest Get(string uri) => new UnityWebRequest();
        public UnityWebRequestAsyncOperation SendWebRequest() => new UnityWebRequestAsyncOperation();
        public void SetRequestHeader(string name, string value) { }
        public string GetResponseHeader(string name) => null;
        public Dictionary<string, string> GetResponseHeaders() => new Dictionary<string, string>();
        public bool isDone => true;
        public float downloadProgress => 1f;
        public long responseCode => 200;
        public string error => null;
        public DownloadHandler downloadHandler { get; set; }
        public UploadHandler uploadHandler { get; set; }
    }

    public class DownloadHandler { public byte[] data => Array.Empty<byte>(); public string text => ""; }
    public class UploadHandler { }
    public class UploadHandlerRaw : UploadHandler { public UploadHandlerRaw(byte[] data) { } }
    public class DownloadHandlerBuffer : DownloadHandler { }
    public class UnityWebRequestAsyncOperation : AsyncOperation { }
    public static class UnityWebRequestTexture { public static UnityWebRequest GetTexture(string uri) => new UnityWebRequest(); }
    public class DownloadHandlerTexture : DownloadHandler { public UnityEngine.Texture2D texture => null; public static UnityEngine.Texture2D GetContent(UnityWebRequest www) => null; }
    public class DownloadHandlerAssetBundle : DownloadHandler { public UnityEngine.AssetBundle assetBundle => null; public static UnityEngine.AssetBundle GetContent(UnityWebRequest www) => null; }
}

namespace UnityEngine
{
    // ---- additional off-battle-path Unity type stubs (CS0246 closure) ----
    public sealed class WaitForSecondsRealtime : YieldInstruction { public WaitForSecondsRealtime(float time) { } }
    public enum AnimationBlendMode { Blend, Additive }
    public class AnimationState { public string name { get; set; } public float speed { get; set; } public float time { get; set; } public float normalizedTime { get; set; } public float length => 0f; public float weight { get; set; } public bool enabled { get; set; } public WrapMode wrapMode { get; set; } public int layer { get; set; } public AnimationBlendMode blendMode { get; set; } public AnimationClip clip => null; }
    public class GUIContent { public GUIContent() { } public GUIContent(string text) { } public string text { get; set; } public Texture image { get; set; } }
    public class TextEditor { public GUIContent content { get; set; } public string text { get; set; } public void Copy() { } public void Paste() { } public void OnFocus() { } public void SelectAll() { } }
    public struct WebCamDevice { public string name => ""; public bool isFrontFacing => false; }
    public class Display { public int systemWidth => 0; public int systemHeight => 0; public int renderingWidth => 0; public int renderingHeight => 0; public static Display main => null; public static Display[] displays => Array.Empty<Display>(); }
}
