export type UserRole = 'owner' | 'pm' | 'member'; export type ProjectStatus = 'green' | 'yellow' | 'red'; export type Direction = 'increase' | 'decrease'; export type PeriodType = 'custom' | '3d' | '1w' | '2w' | 'monthly'; export type ReasonCode = 'RESOURCE' | 'DEPENDENCY' | 'DECISION' | 'SCOPE' | 'EXECUTION' | 'OTHER'; export interface User { id: string; name: string; role: UserRole; avatar_url: string | null; created_at: string; updated_at: string; } export interface Project { id: string; name: string; description: string | null; owner_id: string | null; pm_id: string | null; project_type: string; status: ProjectStatus; created_at: string; updated_at: string; } export interface ProjectMember { project_id: string; user_id: string; } export interface Objective { id: string; project_id: string; title: string; description: string | null; period_start: string; period_end: string; created_by: string | null; created_at: string; updated_at: string; } export interface KR { id: string; project_id: string; objective_id: string | null; period_type: PeriodType; period_name: string | null; period_start: string; period_end: string; title: string; metric_name: string; unit: string; direction: Direction; target_value: number; current_value: number; owner_user_id: string | null; confidence: number; status: ProjectStatus; reason_code: ReasonCode | null; note: string | null; need_owner_help: boolean; created_at: string; updated_at: string; } export interface Checkin { id: string; kr_id: string; project_id: string; user_id: string | null; date: string; current_value: number; delta_value: number | null; confidence: number; status_snapshot: ProjectStatus; reason_code: ReasonCode | null; note: string | null; created_at: string; } export interface Meeting { id: string; project_id: string; period_start: string; period_end: string; summary: string; decisions: string | null; risks: string | null; next_period_commitments: string | null; created_by: string | null; created_at: string; updated_at: string; } export interface Metric { id: string; name: string; unit: string; direction: Direction; category: string | null; is_active: boolean; created_at: string; updated_at: string; } export interface TemplateItem { title: string; metricName: string; unit: string; direction: Direction; targetValue: number; } export interface Template { id: string; name: string; description: string | null; project_type: string | null; tags: string[]; items: TemplateItem[]; is_active: boolean; created_at: string; updated_at: string; } export interface Database { public: { Tables: { users: { Row: User; Insert: Omit & { id?: string }; Update: Partial>; }; projects: { Row: Project; Insert: Omit & { id?: string }; Update: Partial>; }; project_members: { Row: ProjectMember; Insert: ProjectMember; Update: Partial; }; objectives: { Row: Objective; Insert: Omit & { id?: string }; Update: Partial>; }; krs: { Row: KR; Insert: Omit & { id?: string }; Update: Partial>; }; checkins: { Row: Checkin; Insert: Omit & { id?: string }; Update: Partial>; }; meetings: { Row: Meeting; Insert: Omit & { id?: string }; Update: Partial>; }; metrics: { Row: Metric; Insert: Omit & { id?: string }; Update: Partial>; }; templates: { Row: Template; Insert: Omit & { id?: string }; Update: Partial>; }; }; }; }