export type RecordingRestriction = {
  canEditStock: boolean;
  canEditDepletion: boolean;
  canEditEgg: boolean;
  isLocked: boolean;
  lockReason?: string;
};

export const getRecordingRestriction = (
  isLaying: boolean,
  isTransition: boolean,
  currentIsLaying?: boolean
): RecordingRestriction => {
  // if (isTransition && !isLaying) {
  //   const isLayingKandangInTransition = currentIsLaying === true;

  //   if (isLayingKandangInTransition) {
  //     return {
  //       canEditStock: false,
  //       canEditDepletion: true,
  //       canEditEgg: true,
  //       isLocked: false,
  //       lockReason: undefined,
  //     };
  //   } else {
  //     return {
  //       canEditStock: true,
  //       canEditDepletion: false,
  //       canEditEgg: false,
  //       isLocked: false,
  //       lockReason: undefined,
  //     };
  //   }
  // }

  // if (!isLaying && !isTransition && currentIsLaying) {
  //   return {
  //     canEditStock: false,
  //     canEditDepletion: false,
  //     canEditEgg: false,
  //     isLocked: true,
  //     lockReason:
  //       'Recording Growing telah terkunci karena Project Flock sudah masuk fase Laying',
  //   };
  // }

  // if (!isLaying && !isTransition) {
  //   return {
  //     canEditStock: true,
  //     canEditDepletion: true,
  //     canEditEgg: false,
  //     isLocked: false,
  //     lockReason: undefined,
  //   };
  // }
  // if (isLaying && !isTransition) {
  //   return {
  //     canEditStock: true,
  //     canEditDepletion: true,
  //     canEditEgg: true,
  //     isLocked: false,
  //     lockReason: undefined,
  //   };
  // }

  // return {
  //   canEditStock: false,
  //   canEditDepletion: false,
  //   canEditEgg: false,
  //   isLocked: true,
  //   lockReason: 'Kondisi transisi tidak valid',
  // };

  // remove recording transition restriction by request: 30 May 2026, 09:11
  return {
    canEditStock: true,
    canEditDepletion: true,
    canEditEgg: true,
    isLocked: false,
    lockReason: undefined,
  };
};
